| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 bool AfterStartupTaskUtils::Runner::PostDelayedTask( | 205 bool AfterStartupTaskUtils::Runner::PostDelayedTask( |
| 206 const tracked_objects::Location& from_here, | 206 const tracked_objects::Location& from_here, |
| 207 base::OnceClosure task, | 207 base::OnceClosure task, |
| 208 base::TimeDelta delay) { | 208 base::TimeDelta delay) { |
| 209 DCHECK(delay.is_zero()); | 209 DCHECK(delay.is_zero()); |
| 210 AfterStartupTaskUtils::PostTask(from_here, destination_runner_, | 210 AfterStartupTaskUtils::PostTask(from_here, destination_runner_, |
| 211 std::move(task)); | 211 std::move(task)); |
| 212 return true; | 212 return true; |
| 213 } | 213 } |
| 214 | 214 |
| 215 bool AfterStartupTaskUtils::Runner::RunsTasksOnCurrentThread() const { | 215 bool AfterStartupTaskUtils::Runner::RunsTasksInCurrentSequence() const { |
| 216 return destination_runner_->RunsTasksOnCurrentThread(); | 216 return destination_runner_->RunsTasksInCurrentSequence(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void AfterStartupTaskUtils::StartMonitoringStartup() { | 219 void AfterStartupTaskUtils::StartMonitoringStartup() { |
| 220 // The observer is self-deleting. | 220 // The observer is self-deleting. |
| 221 (new StartupObserver)->Start(); | 221 (new StartupObserver)->Start(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void AfterStartupTaskUtils::PostTask( | 224 void AfterStartupTaskUtils::PostTask( |
| 225 const tracked_objects::Location& from_here, | 225 const tracked_objects::Location& from_here, |
| 226 const scoped_refptr<base::TaskRunner>& destination_runner, | 226 const scoped_refptr<base::TaskRunner>& destination_runner, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 247 return ::IsBrowserStartupComplete(); | 247 return ::IsBrowserStartupComplete(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void AfterStartupTaskUtils::UnsafeResetForTesting() { | 250 void AfterStartupTaskUtils::UnsafeResetForTesting() { |
| 251 DCHECK(g_after_startup_tasks.Get().empty()); | 251 DCHECK(g_after_startup_tasks.Get().empty()); |
| 252 if (!IsBrowserStartupComplete()) | 252 if (!IsBrowserStartupComplete()) |
| 253 return; | 253 return; |
| 254 g_startup_complete_flag.Get().UnsafeResetForTesting(); | 254 g_startup_complete_flag.Get().UnsafeResetForTesting(); |
| 255 DCHECK(!IsBrowserStartupComplete()); | 255 DCHECK(!IsBrowserStartupComplete()); |
| 256 } | 256 } |
| OLD | NEW |