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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // Can just directly issue the callback on the background thread. | 140 // Can just directly issue the callback on the background thread. |
141 schedule_this = base::Bind(&InvokeFileLoadCallback, callback, | 141 schedule_this = base::Bind(&InvokeFileLoadCallback, callback, |
142 data->parsed_root.get()); | 142 data->parsed_root.get()); |
143 } else { | 143 } else { |
144 // Load is pending on this file, schedule the invoke. | 144 // Load is pending on this file, schedule the invoke. |
145 data->scheduled_callbacks.push_back(callback); | 145 data->scheduled_callbacks.push_back(callback); |
146 return true; | 146 return true; |
147 } | 147 } |
148 } | 148 } |
149 } | 149 } |
150 g_scheduler->pool()->PostWorkerTaskWithShutdownBehavior( | 150 g_scheduler->ScheduleWork(schedule_this); |
151 FROM_HERE, schedule_this, | |
152 base::SequencedWorkerPool::BLOCK_SHUTDOWN); | |
153 return true; | 151 return true; |
154 } | 152 } |
155 | 153 |
156 const ParseNode* InputFileManager::SyncLoadFile( | 154 const ParseNode* InputFileManager::SyncLoadFile( |
157 const LocationRange& origin, | 155 const LocationRange& origin, |
158 const BuildSettings* build_settings, | 156 const BuildSettings* build_settings, |
159 const SourceFile& file_name, | 157 const SourceFile& file_name, |
160 Err* err) { | 158 Err* err) { |
161 base::AutoLock lock(lock_); | 159 base::AutoLock lock(lock_); |
162 | 160 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 313 |
316 // Run pending invocations. Theoretically we could schedule each of these | 314 // Run pending invocations. Theoretically we could schedule each of these |
317 // separately to get some parallelism. But normally there will only be one | 315 // separately to get some parallelism. But normally there will only be one |
318 // item in the list, so that's extra overhead and complexity for no gain. | 316 // item in the list, so that's extra overhead and complexity for no gain. |
319 if (success) { | 317 if (success) { |
320 for (const auto& cb : callbacks) | 318 for (const auto& cb : callbacks) |
321 cb.Run(unowned_root); | 319 cb.Run(unowned_root); |
322 } | 320 } |
323 return success; | 321 return success; |
324 } | 322 } |
OLD | NEW |