| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // The other load could have failed. In this case that error will be printed | 158 // The other load could have failed. In this case that error will be printed |
| 159 // to the console, but we need to return something here, so make up a | 159 // to the console, but we need to return something here, so make up a |
| 160 // dummy error. | 160 // dummy error. |
| 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 static_cast<int>(input_files_.size()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void InputFileManager::GetAllPhysicalInputFileNames( | 171 void InputFileManager::GetAllPhysicalInputFileNames( |
| 172 std::vector<base::FilePath>* 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 if (!i->second->file.physical_name().empty()) | 177 if (!i->second->file.physical_name().empty()) |
| 178 result->push_back(i->second->file.physical_name()); | 178 result->push_back(i->second->file.physical_name()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 callbacks.swap(data->scheduled_callbacks); | 267 callbacks.swap(data->scheduled_callbacks); |
| 268 } | 268 } |
| 269 | 269 |
| 270 // Run pending invocations. Theoretically we could schedule each of these | 270 // Run pending invocations. Theoretically we could schedule each of these |
| 271 // separately to get some parallelism. But normally there will only be one | 271 // separately to get some parallelism. But normally there will only be one |
| 272 // item in the list, so that's extra overhead and complexity for no gain. | 272 // item in the list, so that's extra overhead and complexity for no gain. |
| 273 for (size_t i = 0; i < callbacks.size(); i++) | 273 for (size_t i = 0; i < callbacks.size(); i++) |
| 274 callbacks[i].Run(unowned_root); | 274 callbacks[i].Run(unowned_root); |
| 275 return true; | 275 return true; |
| 276 } | 276 } |
| OLD | NEW |