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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "tools/gn/build_settings.h" | 10 #include "tools/gn/build_settings.h" |
11 #include "tools/gn/err.h" | 11 #include "tools/gn/err.h" |
12 #include "tools/gn/filesystem_utils.h" | 12 #include "tools/gn/filesystem_utils.h" |
13 #include "tools/gn/input_file_manager.h" | 13 #include "tools/gn/input_file_manager.h" |
14 #include "tools/gn/parse_tree.h" | 14 #include "tools/gn/parse_tree.h" |
15 #include "tools/gn/scheduler.h" | 15 #include "tools/gn/scheduler.h" |
16 #include "tools/gn/scope_per_file_provider.h" | 16 #include "tools/gn/scope_per_file_provider.h" |
17 #include "tools/gn/settings.h" | 17 #include "tools/gn/settings.h" |
18 #include "tools/gn/source_dir.h" | 18 #include "tools/gn/source_dir.h" |
19 #include "tools/gn/source_file.h" | 19 #include "tools/gn/source_file.h" |
20 #include "tools/gn/trace.h" | 20 #include "tools/gn/trace.h" |
21 | 21 |
22 namespace { | |
23 | |
24 std::string GetOutputSubdirName(const Label& toolchain_label, bool is_default) { | |
25 // The default toolchain has no subdir. | |
26 if (is_default) | |
27 return std::string(); | |
28 | |
29 // For now just assume the toolchain name is always a valid dir name. We may | |
30 // want to clean up the in the future. | |
31 return toolchain_label.name(); | |
32 } | |
33 | |
34 } // namespace | |
35 | |
36 // Identifies one time a file is loaded in a given toolchain so we don't load | 22 // Identifies one time a file is loaded in a given toolchain so we don't load |
37 // it more than once. | 23 // it more than once. |
38 struct LoaderImpl::LoadID { | 24 struct LoaderImpl::LoadID { |
39 LoadID() {} | 25 LoadID() {} |
40 LoadID(const SourceFile& f, const Label& tc_name) | 26 LoadID(const SourceFile& f, const Label& tc_name) |
41 : file(f), | 27 : file(f), |
42 toolchain_name(tc_name) { | 28 toolchain_name(tc_name) { |
43 } | 29 } |
44 | 30 |
45 bool operator<(const LoadID& other) const { | 31 bool operator<(const LoadID& other) const { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 const SourceFile& file_name, | 386 const SourceFile& file_name, |
401 const base::Callback<void(const ParseNode*)>& callback, | 387 const base::Callback<void(const ParseNode*)>& callback, |
402 Err* err) { | 388 Err* err) { |
403 if (async_load_file_.is_null()) { | 389 if (async_load_file_.is_null()) { |
404 return g_scheduler->input_file_manager()->AsyncLoadFile( | 390 return g_scheduler->input_file_manager()->AsyncLoadFile( |
405 origin, build_settings, file_name, callback, err); | 391 origin, build_settings, file_name, callback, err); |
406 } | 392 } |
407 return async_load_file_.Run( | 393 return async_load_file_.Run( |
408 origin, build_settings, file_name, callback, err); | 394 origin, build_settings, file_name, callback, err); |
409 } | 395 } |
OLD | NEW |