Index: tools/gn/function_toolchain.cc |
diff --git a/tools/gn/function_toolchain.cc b/tools/gn/function_toolchain.cc |
index dde0306fb14cdc91922c1e534c010e5c47b7400b..cbd8826fa850180a94c23a31bea212779845131a 100644 |
--- a/tools/gn/function_toolchain.cc |
+++ b/tools/gn/function_toolchain.cc |
@@ -98,14 +98,15 @@ Value RunToolchain(Scope* scope, |
const SourceDir& input_dir = scope->GetSourceDir(); |
Label label(input_dir, args[0].string_value()); |
if (g_scheduler->verbose_logging()) |
- g_scheduler->Log("Generating toolchain", label.GetUserVisibleName(false)); |
+ g_scheduler->Log("Definining toolchain", label.GetUserVisibleName(false)); |
// This object will actually be copied into the one owned by the toolchain |
// manager, but that has to be done in the lock. |
- Toolchain toolchain(scope->settings(), label); |
+ scoped_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label)); |
+ toolchain->set_defined_from(function); |
Scope block_scope(scope); |
- block_scope.SetProperty(&kToolchainPropertyKey, &toolchain); |
+ block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get()); |
block->ExecuteBlockInScope(&block_scope, err); |
block_scope.SetProperty(&kToolchainPropertyKey, NULL); |
if (err->has_error()) |
@@ -113,17 +114,7 @@ Value RunToolchain(Scope* scope, |
if (!block_scope.CheckForUnusedVars(err)) |
return Value(); |
- const BuildSettings* build_settings = scope->settings()->build_settings(); |
- { |
- // Save the toolchain definition in the toolchain manager and mark the |
- // corresponding item in the dependency tree resolved so that targets |
- // that depend on this toolchain know it's ready. |
- base::AutoLock lock(build_settings->item_tree().lock()); |
- build_settings->toolchain_manager().SetToolchainDefinitionLocked( |
- toolchain, function->GetRange(), err); |
- build_settings->item_tree().MarkItemDefinedLocked(build_settings, label, |
- err); |
- } |
+ scope->settings()->build_settings()->ItemDefined(toolchain.PassAs<Item>()); |
return Value(); |
} |