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 | |
5 #include "tools/gn/loader.h" | 4 #include "tools/gn/loader.h" |
6 | 5 |
7 #include "base/bind.h" | 6 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
10 #include "tools/gn/build_settings.h" | 9 #include "tools/gn/build_settings.h" |
11 #include "tools/gn/err.h" | 10 #include "tools/gn/err.h" |
12 #include "tools/gn/filesystem_utils.h" | 11 #include "tools/gn/filesystem_utils.h" |
13 #include "tools/gn/input_file_manager.h" | 12 #include "tools/gn/input_file_manager.h" |
14 #include "tools/gn/parse_tree.h" | 13 #include "tools/gn/parse_tree.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 FROM_HERE, base::Bind(&LoaderImpl::DecrementPendingLoads, this)); | 243 FROM_HERE, base::Bind(&LoaderImpl::DecrementPendingLoads, this)); |
245 return; | 244 return; |
246 } | 245 } |
247 | 246 |
248 if (g_scheduler->verbose_logging()) { | 247 if (g_scheduler->verbose_logging()) { |
249 g_scheduler->Log("Running", file_name.value() + " with toolchain " + | 248 g_scheduler->Log("Running", file_name.value() + " with toolchain " + |
250 settings->toolchain_label().GetUserVisibleName(false)); | 249 settings->toolchain_label().GetUserVisibleName(false)); |
251 } | 250 } |
252 | 251 |
253 Scope our_scope(settings->base_config()); | 252 Scope our_scope(settings->base_config()); |
| 253 |
| 254 const auto location = root->GetRange().begin(); |
| 255 if (!location.is_null()) |
| 256 our_scope.AddInputFile(location.file()); |
| 257 |
254 ScopePerFileProvider per_file_provider(&our_scope, true); | 258 ScopePerFileProvider per_file_provider(&our_scope, true); |
255 our_scope.set_source_dir(file_name.GetDir()); | 259 our_scope.set_source_dir(file_name.GetDir()); |
256 | 260 |
257 // Targets, etc. generated as part of running this file will end up here. | 261 // Targets, etc. generated as part of running this file will end up here. |
258 Scope::ItemVector collected_items; | 262 Scope::ItemVector collected_items; |
259 our_scope.set_item_collector(&collected_items); | 263 our_scope.set_item_collector(&collected_items); |
260 | 264 |
261 ScopedTrace trace(TraceItem::TRACE_FILE_EXECUTE, file_name.value()); | 265 ScopedTrace trace(TraceItem::TRACE_FILE_EXECUTE, file_name.value()); |
262 trace.SetToolchain(settings->toolchain_label()); | 266 trace.SetToolchain(settings->toolchain_label()); |
263 | 267 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 const SourceFile& file_name, | 425 const SourceFile& file_name, |
422 const base::Callback<void(const ParseNode*)>& callback, | 426 const base::Callback<void(const ParseNode*)>& callback, |
423 Err* err) { | 427 Err* err) { |
424 if (async_load_file_.is_null()) { | 428 if (async_load_file_.is_null()) { |
425 return g_scheduler->input_file_manager()->AsyncLoadFile( | 429 return g_scheduler->input_file_manager()->AsyncLoadFile( |
426 origin, build_settings, file_name, callback, err); | 430 origin, build_settings, file_name, callback, err); |
427 } | 431 } |
428 return async_load_file_.Run( | 432 return async_load_file_.Run( |
429 origin, build_settings, file_name, callback, err); | 433 origin, build_settings, file_name, callback, err); |
430 } | 434 } |
OLD | NEW |