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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (!data->parsed_root) | 161 if (!data->parsed_root) |
162 *err = Err(origin, "File parse failed"); | 162 *err = Err(origin, "File parse failed"); |
163 return data->parsed_root.get(); | 163 return data->parsed_root.get(); |
164 } | 164 } |
165 | 165 |
166 int InputFileManager::GetInputFileCount() const { | 166 int InputFileManager::GetInputFileCount() const { |
167 base::AutoLock lock(lock_); | 167 base::AutoLock lock(lock_); |
168 return input_files_.size(); | 168 return input_files_.size(); |
169 } | 169 } |
170 | 170 |
171 void InputFileManager::GetAllInputFileNames( | 171 void InputFileManager::GetAllPhysicalInputFileNames( |
172 std::vector<SourceFile>* result) const { | 172 std::vector<base::FilePath>* result) const { |
173 base::AutoLock lock(lock_); | 173 base::AutoLock lock(lock_); |
174 result->reserve(input_files_.size()); | 174 result->reserve(input_files_.size()); |
175 for (InputFileMap::const_iterator i = input_files_.begin(); | 175 for (InputFileMap::const_iterator i = input_files_.begin(); |
176 i != input_files_.end(); ++i) { | 176 i != input_files_.end(); ++i) { |
177 result->push_back(i->second->file.name()); | 177 if (!i->second->file.physical_name().empty()) |
| 178 result->push_back(i->second->file.physical_name()); |
178 } | 179 } |
179 } | 180 } |
180 | 181 |
181 void InputFileManager::BackgroundLoadFile(const LocationRange& origin, | 182 void InputFileManager::BackgroundLoadFile(const LocationRange& origin, |
182 const BuildSettings* build_settings, | 183 const BuildSettings* build_settings, |
183 const SourceFile& name, | 184 const SourceFile& name, |
184 InputFile* file) { | 185 InputFile* file) { |
185 Err err; | 186 Err err; |
186 if (!LoadFile(origin, build_settings, name, file, &err)) | 187 if (!LoadFile(origin, build_settings, name, file, &err)) |
187 g_scheduler->FailWithError(err); | 188 g_scheduler->FailWithError(err); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 callbacks.swap(data->scheduled_callbacks); | 243 callbacks.swap(data->scheduled_callbacks); |
243 } | 244 } |
244 | 245 |
245 // Run pending invocations. Theoretically we could schedule each of these | 246 // Run pending invocations. Theoretically we could schedule each of these |
246 // separately to get some parallelism. But normally there will only be one | 247 // separately to get some parallelism. But normally there will only be one |
247 // item in the list, so that's extra overhead and complexity for no gain. | 248 // item in the list, so that's extra overhead and complexity for no gain. |
248 for (size_t i = 0; i < callbacks.size(); i++) | 249 for (size_t i = 0; i < callbacks.size(); i++) |
249 callbacks[i].Run(unowned_root); | 250 callbacks[i].Run(unowned_root); |
250 return true; | 251 return true; |
251 } | 252 } |
OLD | NEW |