OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/after_startup_task_utils.h" | 5 #include "chrome/browser/after_startup_task_utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 bool AfterStartupTaskUtils::Runner::PostDelayedTask( | 210 bool AfterStartupTaskUtils::Runner::PostDelayedTask( |
211 const tracked_objects::Location& from_here, | 211 const tracked_objects::Location& from_here, |
212 base::OnceClosure task, | 212 base::OnceClosure task, |
213 base::TimeDelta delay) { | 213 base::TimeDelta delay) { |
214 DCHECK(delay.is_zero()); | 214 DCHECK(delay.is_zero()); |
215 AfterStartupTaskUtils::PostTask(from_here, destination_runner_, | 215 AfterStartupTaskUtils::PostTask(from_here, destination_runner_, |
216 std::move(task)); | 216 std::move(task)); |
217 return true; | 217 return true; |
218 } | 218 } |
219 | 219 |
220 bool AfterStartupTaskUtils::Runner::RunsTasksOnCurrentThread() const { | 220 bool AfterStartupTaskUtils::Runner::RunsTasksInCurrentSequence() const { |
221 return destination_runner_->RunsTasksOnCurrentThread(); | 221 return destination_runner_->RunsTasksInCurrentSequence(); |
222 } | 222 } |
223 | 223 |
224 void AfterStartupTaskUtils::StartMonitoringStartup() { | 224 void AfterStartupTaskUtils::StartMonitoringStartup() { |
225 // The observer is self-deleting. | 225 // The observer is self-deleting. |
226 (new StartupObserver)->Start(); | 226 (new StartupObserver)->Start(); |
227 } | 227 } |
228 | 228 |
229 void AfterStartupTaskUtils::PostTask( | 229 void AfterStartupTaskUtils::PostTask( |
230 const tracked_objects::Location& from_here, | 230 const tracked_objects::Location& from_here, |
231 const scoped_refptr<base::TaskRunner>& destination_runner, | 231 const scoped_refptr<base::TaskRunner>& destination_runner, |
(...skipping 20 matching lines...) Expand all Loading... |
252 return ::IsBrowserStartupComplete(); | 252 return ::IsBrowserStartupComplete(); |
253 } | 253 } |
254 | 254 |
255 void AfterStartupTaskUtils::UnsafeResetForTesting() { | 255 void AfterStartupTaskUtils::UnsafeResetForTesting() { |
256 DCHECK(g_after_startup_tasks.Get().empty()); | 256 DCHECK(g_after_startup_tasks.Get().empty()); |
257 if (!IsBrowserStartupComplete()) | 257 if (!IsBrowserStartupComplete()) |
258 return; | 258 return; |
259 g_startup_complete_flag.Get().UnsafeResetForTesting(); | 259 g_startup_complete_flag.Get().UnsafeResetForTesting(); |
260 DCHECK(!IsBrowserStartupComplete()); | 260 DCHECK(!IsBrowserStartupComplete()); |
261 } | 261 } |
OLD | NEW |