| 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/input_file_manager.h" | 5 #include "tools/gn/input_file_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "tools/gn/filesystem_utils.h" | 9 #include "tools/gn/filesystem_utils.h" |
| 10 #include "tools/gn/parser.h" | 10 #include "tools/gn/parser.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Read. | 39 // Read. |
| 40 base::FilePath primary_path = build_settings->GetFullPath(name); | 40 base::FilePath primary_path = build_settings->GetFullPath(name); |
| 41 ScopedTrace load_trace(TraceItem::TRACE_FILE_LOAD, name.value()); | 41 ScopedTrace load_trace(TraceItem::TRACE_FILE_LOAD, name.value()); |
| 42 if (!file->Load(primary_path)) { | 42 if (!file->Load(primary_path)) { |
| 43 if (!build_settings->secondary_source_path().empty()) { | 43 if (!build_settings->secondary_source_path().empty()) { |
| 44 // Fall back to secondary source tree. | 44 // Fall back to secondary source tree. |
| 45 base::FilePath secondary_path = | 45 base::FilePath secondary_path = |
| 46 build_settings->GetFullPathSecondary(name); | 46 build_settings->GetFullPathSecondary(name); |
| 47 if (!file->Load(secondary_path)) { | 47 if (!file->Load(secondary_path)) { |
| 48 *err = Err(origin, "Can't load input file.", | 48 *err = Err(origin, "Can't load input file.", |
| 49 "Unable to load either \n" + | 49 "Unable to load:\n " + |
| 50 FilePathToUTF8(primary_path) + " or \n" + | 50 FilePathToUTF8(primary_path) + "\n" |
| 51 "I also checked in the secondary tree for:\n " + |
| 51 FilePathToUTF8(secondary_path)); | 52 FilePathToUTF8(secondary_path)); |
| 52 return false; | 53 return false; |
| 53 } | 54 } |
| 54 } else { | 55 } else { |
| 55 *err = Err(origin, | 56 *err = Err(origin, |
| 56 "Unable to load \"" + FilePathToUTF8(primary_path) + "\"."); | 57 "Unable to load \"" + FilePathToUTF8(primary_path) + "\"."); |
| 57 return false; | 58 return false; |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 load_trace.Done(); | 61 load_trace.Done(); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 309 |
| 309 // Run pending invocations. Theoretically we could schedule each of these | 310 // Run pending invocations. Theoretically we could schedule each of these |
| 310 // separately to get some parallelism. But normally there will only be one | 311 // separately to get some parallelism. But normally there will only be one |
| 311 // item in the list, so that's extra overhead and complexity for no gain. | 312 // item in the list, so that's extra overhead and complexity for no gain. |
| 312 if (success) { | 313 if (success) { |
| 313 for (size_t i = 0; i < callbacks.size(); i++) | 314 for (size_t i = 0; i < callbacks.size(); i++) |
| 314 callbacks[i].Run(unowned_root); | 315 callbacks[i].Run(unowned_root); |
| 315 } | 316 } |
| 316 return success; | 317 return success; |
| 317 } | 318 } |
| OLD | NEW |