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

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

Issue 56433003: GN threading refactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | « tools/gn/function_set_default_toolchain.cc ('k') | tools/gn/functions.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/err.h" 5 #include "tools/gn/err.h"
6 #include "tools/gn/functions.h" 6 #include "tools/gn/functions.h"
7 #include "tools/gn/parse_tree.h" 7 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/scheduler.h" 8 #include "tools/gn/scheduler.h"
9 #include "tools/gn/scope.h" 9 #include "tools/gn/scope.h"
10 #include "tools/gn/settings.h" 10 #include "tools/gn/settings.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (!EnsureNotProcessingImport(function, scope, err) || 91 if (!EnsureNotProcessingImport(function, scope, err) ||
92 !EnsureNotProcessingBuildConfig(function, scope, err)) 92 !EnsureNotProcessingBuildConfig(function, scope, err))
93 return Value(); 93 return Value();
94 94
95 // Note that we don't want to use MakeLabelForScope since that will include 95 // Note that we don't want to use MakeLabelForScope since that will include
96 // the toolchain name in the label, and toolchain labels don't themselves 96 // the toolchain name in the label, and toolchain labels don't themselves
97 // have toolchain names. 97 // have toolchain names.
98 const SourceDir& input_dir = scope->GetSourceDir(); 98 const SourceDir& input_dir = scope->GetSourceDir();
99 Label label(input_dir, args[0].string_value()); 99 Label label(input_dir, args[0].string_value());
100 if (g_scheduler->verbose_logging()) 100 if (g_scheduler->verbose_logging())
101 g_scheduler->Log("Generating toolchain", label.GetUserVisibleName(false)); 101 g_scheduler->Log("Definining toolchain", label.GetUserVisibleName(false));
102 102
103 // This object will actually be copied into the one owned by the toolchain 103 // This object will actually be copied into the one owned by the toolchain
104 // manager, but that has to be done in the lock. 104 // manager, but that has to be done in the lock.
105 Toolchain toolchain(scope->settings(), label); 105 scoped_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label));
106 toolchain->set_defined_from(function);
106 107
107 Scope block_scope(scope); 108 Scope block_scope(scope);
108 block_scope.SetProperty(&kToolchainPropertyKey, &toolchain); 109 block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get());
109 block->ExecuteBlockInScope(&block_scope, err); 110 block->ExecuteBlockInScope(&block_scope, err);
110 block_scope.SetProperty(&kToolchainPropertyKey, NULL); 111 block_scope.SetProperty(&kToolchainPropertyKey, NULL);
111 if (err->has_error()) 112 if (err->has_error())
112 return Value(); 113 return Value();
113 if (!block_scope.CheckForUnusedVars(err)) 114 if (!block_scope.CheckForUnusedVars(err))
114 return Value(); 115 return Value();
115 116
116 const BuildSettings* build_settings = scope->settings()->build_settings(); 117 scope->settings()->build_settings()->ItemDefined(toolchain.PassAs<Item>());
117 {
118 // Save the toolchain definition in the toolchain manager and mark the
119 // corresponding item in the dependency tree resolved so that targets
120 // that depend on this toolchain know it's ready.
121 base::AutoLock lock(build_settings->item_tree().lock());
122 build_settings->toolchain_manager().SetToolchainDefinitionLocked(
123 toolchain, function->GetRange(), err);
124 build_settings->item_tree().MarkItemDefinedLocked(build_settings, label,
125 err);
126 }
127 return Value(); 118 return Value();
128 } 119 }
129 120
130 // tool ------------------------------------------------------------------------ 121 // tool ------------------------------------------------------------------------
131 122
132 const char kTool[] = "tool"; 123 const char kTool[] = "tool";
133 const char kTool_Help[] = 124 const char kTool_Help[] =
134 "tool: Specify arguments to a toolchain tool.\n" 125 "tool: Specify arguments to a toolchain tool.\n"
135 "\n" 126 "\n"
136 " tool(<command type>) { <command flags> }\n" 127 " tool(<command type>) { <command flags> }\n"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 return Value(); 288 return Value();
298 289
299 Scope::KeyValueMap values; 290 Scope::KeyValueMap values;
300 block_scope.GetCurrentScopeValues(&values); 291 block_scope.GetCurrentScopeValues(&values);
301 toolchain->args() = values; 292 toolchain->args() = values;
302 293
303 return Value(); 294 return Value();
304 } 295 }
305 296
306 } // namespace functions 297 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/function_set_default_toolchain.cc ('k') | tools/gn/functions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698