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

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

Issue 2926013002: Support explicit pools in actions (Closed)
Patch Set: Support explicit pools in actions Created 3 years, 6 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
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/loader.h" 5 #include "tools/gn/loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "tools/gn/build_settings.h" 10 #include "tools/gn/build_settings.h"
11 #include "tools/gn/err.h" 11 #include "tools/gn/err.h"
12 #include "tools/gn/filesystem_utils.h" 12 #include "tools/gn/filesystem_utils.h"
13 #include "tools/gn/functions.h"
13 #include "tools/gn/input_file_manager.h" 14 #include "tools/gn/input_file_manager.h"
14 #include "tools/gn/parse_tree.h" 15 #include "tools/gn/parse_tree.h"
16 #include "tools/gn/pool.h"
15 #include "tools/gn/scheduler.h" 17 #include "tools/gn/scheduler.h"
16 #include "tools/gn/scope_per_file_provider.h" 18 #include "tools/gn/scope_per_file_provider.h"
17 #include "tools/gn/settings.h" 19 #include "tools/gn/settings.h"
18 #include "tools/gn/source_dir.h" 20 #include "tools/gn/source_dir.h"
19 #include "tools/gn/source_file.h" 21 #include "tools/gn/source_file.h"
20 #include "tools/gn/trace.h" 22 #include "tools/gn/trace.h"
23 #include "tools/gn/variables.h"
21 24
22 namespace { 25 namespace {
23 26
24 struct SourceFileAndOrigin { 27 struct SourceFileAndOrigin {
25 SourceFileAndOrigin(const SourceFile& f, const LocationRange& o) 28 SourceFileAndOrigin(const SourceFile& f, const LocationRange& o)
26 : file(f), 29 : file(f),
27 origin(o) { 30 origin(o) {
28 } 31 }
29 32
30 SourceFile file; 33 SourceFile file;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 g_scheduler->FailWithError(Err(Location(), 335 g_scheduler->FailWithError(Err(Location(),
333 "The default build config file did not call set_default_toolchain()", 336 "The default build config file did not call set_default_toolchain()",
334 "If you don't call this, I can't figure out what toolchain to use\n" 337 "If you don't call this, I can't figure out what toolchain to use\n"
335 "for all of this code.")); 338 "for all of this code."));
336 } else { 339 } else {
337 DCHECK(settings->toolchain_label().is_null()); 340 DCHECK(settings->toolchain_label().is_null());
338 settings->set_toolchain_label(default_toolchain_label); 341 settings->set_toolchain_label(default_toolchain_label);
339 } 342 }
340 } 343 }
341 344
345 // Create the predefined console pool object.
brettw 2017/06/28 21:23:27 This seems weird to me. It looks like this will be
Petr Hosek 2017/06/28 23:42:32 It has "//:console" label but it's accessible thro
346 Label label(MakeLabelForScope(base_config, nullptr, "console"));
347 std::unique_ptr<Pool> pool(new Pool(base_config->settings(), label));
348 pool->set_console(true);
349 Value console_val(nullptr, label.GetUserVisibleName(true));
350 base_config->SetValue(variables::kConsole, console_val, nullptr);
351 settings->build_settings()->ItemDefined(std::move(pool));
352
342 task_runner_->PostTask(FROM_HERE, 353 task_runner_->PostTask(FROM_HERE,
343 base::Bind(&LoaderImpl::DidLoadBuildConfig, this, 354 base::Bind(&LoaderImpl::DidLoadBuildConfig, this,
344 settings->toolchain_label())); 355 settings->toolchain_label()));
345 } 356 }
346 357
347 void LoaderImpl::DidLoadFile() { 358 void LoaderImpl::DidLoadFile() {
348 DecrementPendingLoads(); 359 DecrementPendingLoads();
349 } 360 }
350 361
351 void LoaderImpl::DidLoadBuildConfig(const Label& label) { 362 void LoaderImpl::DidLoadBuildConfig(const Label& label) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 const SourceFile& file_name, 432 const SourceFile& file_name,
422 const base::Callback<void(const ParseNode*)>& callback, 433 const base::Callback<void(const ParseNode*)>& callback,
423 Err* err) { 434 Err* err) {
424 if (async_load_file_.is_null()) { 435 if (async_load_file_.is_null()) {
425 return g_scheduler->input_file_manager()->AsyncLoadFile( 436 return g_scheduler->input_file_manager()->AsyncLoadFile(
426 origin, build_settings, file_name, callback, err); 437 origin, build_settings, file_name, callback, err);
427 } 438 }
428 return async_load_file_.Run( 439 return async_load_file_.Run(
429 origin, build_settings, file_name, callback, err); 440 origin, build_settings, file_name, callback, err);
430 } 441 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698