| OLD | NEW |
| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 10 #include "tools/gn/build_settings.h" | 11 #include "tools/gn/build_settings.h" |
| 11 #include "tools/gn/err.h" | 12 #include "tools/gn/err.h" |
| 12 #include "tools/gn/filesystem_utils.h" | 13 #include "tools/gn/filesystem_utils.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" |
| 15 #include "tools/gn/scheduler.h" | 16 #include "tools/gn/scheduler.h" |
| 16 #include "tools/gn/scope_per_file_provider.h" | 17 #include "tools/gn/scope_per_file_provider.h" |
| 17 #include "tools/gn/settings.h" | 18 #include "tools/gn/settings.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 Err err; | 260 Err err; |
| 260 root->Execute(&our_scope, &err); | 261 root->Execute(&our_scope, &err); |
| 261 if (err.has_error()) | 262 if (err.has_error()) |
| 262 g_scheduler->FailWithError(err); | 263 g_scheduler->FailWithError(err); |
| 263 | 264 |
| 264 if (!our_scope.CheckForUnusedVars(&err)) | 265 if (!our_scope.CheckForUnusedVars(&err)) |
| 265 g_scheduler->FailWithError(err); | 266 g_scheduler->FailWithError(err); |
| 266 | 267 |
| 267 // Pass all of the items that were defined off to the builder. | 268 // Pass all of the items that were defined off to the builder. |
| 268 for (auto& item : collected_items) { | 269 for (auto& item : collected_items) { |
| 269 settings->build_settings()->ItemDefined(make_scoped_ptr(item)); | 270 settings->build_settings()->ItemDefined(base::WrapUnique(item)); |
| 270 item = nullptr; | 271 item = nullptr; |
| 271 } | 272 } |
| 272 | 273 |
| 273 trace.Done(); | 274 trace.Done(); |
| 274 | 275 |
| 275 main_loop_->PostTask(FROM_HERE, base::Bind(&LoaderImpl::DidLoadFile, this)); | 276 main_loop_->PostTask(FROM_HERE, base::Bind(&LoaderImpl::DidLoadFile, this)); |
| 276 } | 277 } |
| 277 | 278 |
| 278 void LoaderImpl::BackgroundLoadBuildConfig( | 279 void LoaderImpl::BackgroundLoadBuildConfig( |
| 279 Settings* settings, | 280 Settings* settings, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 const SourceFile& file_name, | 411 const SourceFile& file_name, |
| 411 const base::Callback<void(const ParseNode*)>& callback, | 412 const base::Callback<void(const ParseNode*)>& callback, |
| 412 Err* err) { | 413 Err* err) { |
| 413 if (async_load_file_.is_null()) { | 414 if (async_load_file_.is_null()) { |
| 414 return g_scheduler->input_file_manager()->AsyncLoadFile( | 415 return g_scheduler->input_file_manager()->AsyncLoadFile( |
| 415 origin, build_settings, file_name, callback, err); | 416 origin, build_settings, file_name, callback, err); |
| 416 } | 417 } |
| 417 return async_load_file_.Run( | 418 return async_load_file_.Run( |
| 418 origin, build_settings, file_name, callback, err); | 419 origin, build_settings, file_name, callback, err); |
| 419 } | 420 } |
| OLD | NEW |