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

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

Issue 1544333002: Convert Pass()→std::move() in //tools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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_unittest.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 <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/stl_util.h" 10 #include "base/stl_util.h"
9 #include "tools/gn/filesystem_utils.h" 11 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/parser.h" 12 #include "tools/gn/parser.h"
11 #include "tools/gn/scheduler.h" 13 #include "tools/gn/scheduler.h"
12 #include "tools/gn/scope_per_file_provider.h" 14 #include "tools/gn/scope_per_file_provider.h"
13 #include "tools/gn/tokenizer.h" 15 #include "tools/gn/tokenizer.h"
14 #include "tools/gn/trace.h" 16 #include "tools/gn/trace.h"
15 17
16 namespace { 18 namespace {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 282
281 std::vector<FileLoadCallback> callbacks; 283 std::vector<FileLoadCallback> callbacks;
282 { 284 {
283 base::AutoLock lock(lock_); 285 base::AutoLock lock(lock_);
284 DCHECK(input_files_.find(name) != input_files_.end()); 286 DCHECK(input_files_.find(name) != input_files_.end());
285 287
286 InputFileData* data = input_files_[name]; 288 InputFileData* data = input_files_[name];
287 data->loaded = true; 289 data->loaded = true;
288 if (success) { 290 if (success) {
289 data->tokens.swap(tokens); 291 data->tokens.swap(tokens);
290 data->parsed_root = root.Pass(); 292 data->parsed_root = std::move(root);
291 } else { 293 } else {
292 data->parse_error = *err; 294 data->parse_error = *err;
293 } 295 }
294 296
295 // Unblock waiters on this event. 297 // Unblock waiters on this event.
296 // 298 //
297 // It's somewhat bad to signal this inside the lock. When it's used, it's 299 // It's somewhat bad to signal this inside the lock. When it's used, it's
298 // lazily created inside the lock. So we need to do the check and signal 300 // lazily created inside the lock. So we need to do the check and signal
299 // inside the lock to avoid race conditions on the lazy creation of the 301 // inside the lock to avoid race conditions on the lazy creation of the
300 // lock. 302 // lock.
(...skipping 10 matching lines...) Expand all
311 313
312 // Run pending invocations. Theoretically we could schedule each of these 314 // Run pending invocations. Theoretically we could schedule each of these
313 // separately to get some parallelism. But normally there will only be one 315 // separately to get some parallelism. But normally there will only be one
314 // item in the list, so that's extra overhead and complexity for no gain. 316 // item in the list, so that's extra overhead and complexity for no gain.
315 if (success) { 317 if (success) {
316 for (const auto& cb : callbacks) 318 for (const auto& cb : callbacks)
317 cb.Run(unowned_root); 319 cb.Run(unowned_root);
318 } 320 }
319 return success; 321 return success;
320 } 322 }
OLDNEW
« no previous file with comments | « tools/gn/input_conversion.cc ('k') | tools/gn/loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698