Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: tools/gn/input_file_manager.cc

Issue 610293003: Replace more for loops in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/input_conversion.cc ('k') | tools/gn/loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/input_file_manager.h" 5 #include "tools/gn/input_file_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/parser.h" 10 #include "tools/gn/parser.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 int InputFileManager::GetInputFileCount() const { 249 int InputFileManager::GetInputFileCount() const {
250 base::AutoLock lock(lock_); 250 base::AutoLock lock(lock_);
251 return static_cast<int>(input_files_.size()); 251 return static_cast<int>(input_files_.size());
252 } 252 }
253 253
254 void InputFileManager::GetAllPhysicalInputFileNames( 254 void InputFileManager::GetAllPhysicalInputFileNames(
255 std::vector<base::FilePath>* result) const { 255 std::vector<base::FilePath>* result) const {
256 base::AutoLock lock(lock_); 256 base::AutoLock lock(lock_);
257 result->reserve(input_files_.size()); 257 result->reserve(input_files_.size());
258 for (InputFileMap::const_iterator i = input_files_.begin(); 258 for (const auto& file : input_files_) {
259 i != input_files_.end(); ++i) { 259 if (!file.second->file.physical_name().empty())
260 if (!i->second->file.physical_name().empty()) 260 result->push_back(file.second->file.physical_name());
261 result->push_back(i->second->file.physical_name());
262 } 261 }
263 } 262 }
264 263
265 void InputFileManager::BackgroundLoadFile(const LocationRange& origin, 264 void InputFileManager::BackgroundLoadFile(const LocationRange& origin,
266 const BuildSettings* build_settings, 265 const BuildSettings* build_settings,
267 const SourceFile& name, 266 const SourceFile& name,
268 InputFile* file) { 267 InputFile* file) {
269 Err err; 268 Err err;
270 if (!LoadFile(origin, build_settings, name, file, &err)) 269 if (!LoadFile(origin, build_settings, name, file, &err))
271 g_scheduler->FailWithError(err); 270 g_scheduler->FailWithError(err);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (data->completion_event) 312 if (data->completion_event)
314 data->completion_event->Signal(); 313 data->completion_event->Signal();
315 314
316 callbacks.swap(data->scheduled_callbacks); 315 callbacks.swap(data->scheduled_callbacks);
317 } 316 }
318 317
319 // Run pending invocations. Theoretically we could schedule each of these 318 // Run pending invocations. Theoretically we could schedule each of these
320 // separately to get some parallelism. But normally there will only be one 319 // separately to get some parallelism. But normally there will only be one
321 // item in the list, so that's extra overhead and complexity for no gain. 320 // item in the list, so that's extra overhead and complexity for no gain.
322 if (success) { 321 if (success) {
323 for (size_t i = 0; i < callbacks.size(); i++) 322 for (const auto& cb : callbacks)
324 callbacks[i].Run(unowned_root); 323 cb.Run(unowned_root);
325 } 324 }
326 return success; 325 return success;
327 } 326 }
OLDNEW
« no previous file with comments | « tools/gn/input_conversion.cc ('k') | tools/gn/loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698