chore: change some for loops to range-based (#37912)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
trop[bot]
2023-04-11 12:25:55 +02:00
committed by GitHub
parent 8ae741102d
commit a36e44c973
3 changed files with 6 additions and 7 deletions

View File

@@ -115,10 +115,10 @@ v8::Local<v8::Value> ServiceWorkerContext::GetAllRunningWorkerInfo(
gin::DataObjectBuilder builder(isolate);
const base::flat_map<int64_t, content::ServiceWorkerRunningInfo>& info_map =
service_worker_context_->GetRunningServiceWorkerInfos();
for (auto iter = info_map.begin(); iter != info_map.end(); ++iter) {
for (const auto& iter : info_map) {
builder.Set(
std::to_string(iter->first),
ServiceWorkerRunningInfoToDict(isolate, std::move(iter->second)));
std::to_string(iter.first),
ServiceWorkerRunningInfoToDict(isolate, std::move(iter.second)));
}
return builder.Build();
}

View File

@@ -240,8 +240,8 @@ std::vector<blink::MessagePortChannel> MessagePort::DisentanglePorts(
// Passed-in ports passed validity checks, so we can disentangle them.
std::vector<blink::MessagePortChannel> channels;
channels.reserve(ports.size());
for (unsigned i = 0; i < ports.size(); ++i)
channels.push_back(ports[i]->Disentangle());
for (auto port : ports)
channels.push_back(port->Disentangle());
return channels;
}

View File

@@ -578,8 +578,7 @@ bool Converter<scoped_refptr<network::ResourceRequestBody>>::FromV8(
return false;
base::Value::List& list = list_value.GetList();
*out = base::MakeRefCounted<network::ResourceRequestBody>();
for (size_t i = 0; i < list.size(); ++i) {
base::Value& dict_value = list[i];
for (base::Value& dict_value : list) {
if (!dict_value.is_dict())
return false;
base::Value::Dict& dict = dict_value.GetDict();