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->ScheduleWork(schedule_this); | 150 g_scheduler->pool()->PostWorkerTaskWithShutdownBehavior( |
| 151 FROM_HERE, schedule_this, |
| 152 base::SequencedWorkerPool::BLOCK_SHUTDOWN); |
151 return true; | 153 return true; |
152 } | 154 } |
153 | 155 |
154 const ParseNode* InputFileManager::SyncLoadFile( | 156 const ParseNode* InputFileManager::SyncLoadFile( |
155 const LocationRange& origin, | 157 const LocationRange& origin, |
156 const BuildSettings* build_settings, | 158 const BuildSettings* build_settings, |
157 const SourceFile& file_name, | 159 const SourceFile& file_name, |
158 Err* err) { | 160 Err* err) { |
159 base::AutoLock lock(lock_); | 161 base::AutoLock lock(lock_); |
160 | 162 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 315 |
314 // Run pending invocations. Theoretically we could schedule each of these | 316 // Run pending invocations. Theoretically we could schedule each of these |
315 // separately to get some parallelism. But normally there will only be one | 317 // separately to get some parallelism. But normally there will only be one |
316 // item in the list, so that's extra overhead and complexity for no gain. | 318 // item in the list, so that's extra overhead and complexity for no gain. |
317 if (success) { | 319 if (success) { |
318 for (const auto& cb : callbacks) | 320 for (const auto& cb : callbacks) |
319 cb.Run(unowned_root); | 321 cb.Run(unowned_root); |
320 } | 322 } |
321 return success; | 323 return success; |
322 } | 324 } |
OLD | NEW |