refactor: use C++20's contains() method (#45742)
* chore: use std::map<>::contains() instead of count() or find() * chore: use std::map<>::contains() instead of base::Contains()
This commit is contained in:
parent
612da3ec47
commit
2a383e9ddd
29 changed files with 54 additions and 77 deletions
|
@ -11,7 +11,6 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
|
@ -69,7 +68,7 @@ bool DeepFreeze(const v8::Local<v8::Object>& object,
|
|||
const v8::Local<v8::Context>& context,
|
||||
std::set<int> frozen = std::set<int>()) {
|
||||
int hash = object->GetIdentityHash();
|
||||
if (base::Contains(frozen, hash))
|
||||
if (frozen.contains(hash))
|
||||
return true;
|
||||
frozen.insert(hash);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/strings/utf_string_conversion_utils.h"
|
||||
|
@ -190,13 +189,13 @@ void SpellCheckClient::OnSpellCheckDone(
|
|||
auto& word_list = pending_request_param_->wordlist();
|
||||
|
||||
for (const auto& word : word_list) {
|
||||
if (base::Contains(misspelled, word.text)) {
|
||||
if (misspelled.contains(word.text)) {
|
||||
// If this is a contraction, iterate through parts and accept the word
|
||||
// if none of them are misspelled
|
||||
if (!word.contraction_words.empty()) {
|
||||
auto all_correct = true;
|
||||
for (const auto& contraction_word : word.contraction_words) {
|
||||
if (base::Contains(misspelled, contraction_word)) {
|
||||
if (misspelled.contains(contraction_word)) {
|
||||
all_correct = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ void ElectronRendererClient::WillDestroyWorkerContextOnWorkerThread(
|
|||
|
||||
node::Environment* ElectronRendererClient::GetEnvironment(
|
||||
content::RenderFrame* render_frame) const {
|
||||
if (!base::Contains(injected_frames_, render_frame))
|
||||
if (!injected_frames_.contains(render_frame))
|
||||
return nullptr;
|
||||
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
|
||||
auto context =
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "base/base_paths.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/process/process_metrics.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "shell/common/api/electron_bindings.h"
|
||||
|
@ -158,7 +157,7 @@ void ElectronSandboxedRendererClient::WillReleaseScriptContext(
|
|||
void ElectronSandboxedRendererClient::EmitProcessEvent(
|
||||
content::RenderFrame* render_frame,
|
||||
const char* event_name) {
|
||||
if (!base::Contains(injected_frames_, render_frame))
|
||||
if (!injected_frames_.contains(render_frame))
|
||||
return;
|
||||
|
||||
blink::WebLocalFrame* frame = render_frame->GetWebFrame();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue