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

Side by Side Diff: trunk/src/tools/gn/config.cc

Issue 46313006: Revert 232657 "GN: toolchain threading cleanup" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/tools/gn/config.h ('k') | trunk/src/tools/gn/function_exec_script.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/config.h" 5 #include "tools/gn/config.h"
6 6
7 #include "tools/gn/err.h" 7 #include "tools/gn/err.h"
8 #include "tools/gn/input_file_manager.h" 8 #include "tools/gn/input_file_manager.h"
9 #include "tools/gn/item_node.h" 9 #include "tools/gn/item_node.h"
10 #include "tools/gn/item_tree.h" 10 #include "tools/gn/item_tree.h"
11 #include "tools/gn/scheduler.h" 11 #include "tools/gn/scheduler.h"
12 12
13 Config::Config(const Settings* settings, const Label& label) 13 Config::Config(const Label& label) : Item(label) {
14 : Item(settings, label) {
15 } 14 }
16 15
17 Config::~Config() { 16 Config::~Config() {
18 } 17 }
19 18
20 Config* Config::AsConfig() { 19 Config* Config::AsConfig() {
21 return this; 20 return this;
22 } 21 }
23 22
24 const Config* Config::AsConfig() const { 23 const Config* Config::AsConfig() const {
25 return this; 24 return this;
26 } 25 }
27 26
28 // static 27 // static
29 Config* Config::GetConfig(const Settings* settings, 28 Config* Config::GetConfig(const Settings* settings,
30 const LocationRange& specified_from_here, 29 const LocationRange& specified_from_here,
31 const Label& label, 30 const Label& label,
32 Item* dep_from, 31 Item* dep_from,
33 Err* err) { 32 Err* err) {
34 DCHECK(!label.is_null()); 33 DCHECK(!label.is_null());
35 34
36 ItemTree* tree = &settings->build_settings()->item_tree(); 35 ItemTree* tree = &settings->build_settings()->item_tree();
37 base::AutoLock lock(tree->lock()); 36 base::AutoLock lock(tree->lock());
38 37
39 ItemNode* node = tree->GetExistingNodeLocked(label); 38 ItemNode* node = tree->GetExistingNodeLocked(label);
40 Config* config = NULL; 39 Config* config = NULL;
41 if (!node) { 40 if (!node) {
42 config = new Config(settings, label); 41 config = new Config(label);
43 node = new ItemNode(config); 42 node = new ItemNode(config);
44 node->set_originally_referenced_from_here(specified_from_here); 43 node->set_originally_referenced_from_here(specified_from_here);
45 tree->AddNodeLocked(node); 44 tree->AddNodeLocked(node);
46 45
47 // Only schedule loading the given target if somebody is depending on it 46 // Only schedule loading the given target if somebody is depending on it
48 // (and we optimize by not re-asking it to run the current file). 47 // (and we optimize by not re-asking it to run the current file).
49 // Otherwise, we're probably generating it right now. 48 // Otherwise, we're probably generating it right now.
50 if (dep_from && dep_from->label().dir() != label.dir()) { 49 if (dep_from && dep_from->label().dir() != label.dir()) {
51 settings->build_settings()->toolchain_manager().ScheduleInvocationLocked( 50 settings->build_settings()->toolchain_manager().ScheduleInvocationLocked(
52 specified_from_here, label.GetToolchainLabel(), label.dir(), 51 specified_from_here, label.GetToolchainLabel(), label.dir(),
(...skipping 20 matching lines...) Expand all
73 72
74 // Keep a record of the guy asking us for this dependency. We know if 73 // Keep a record of the guy asking us for this dependency. We know if
75 // somebody is adding a dependency, that guy it himself not resolved. 74 // somebody is adding a dependency, that guy it himself not resolved.
76 if (dep_from) { 75 if (dep_from) {
77 if (!dep_from->item_node()->AddDependency( 76 if (!dep_from->item_node()->AddDependency(
78 settings->build_settings(), specified_from_here, node, err)) 77 settings->build_settings(), specified_from_here, node, err))
79 return NULL; 78 return NULL;
80 } 79 }
81 return config; 80 return config;
82 } 81 }
OLDNEW
« no previous file with comments | « trunk/src/tools/gn/config.h ('k') | trunk/src/tools/gn/function_exec_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698