| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/process/process_info.h" | 10 #include "base/process/process_info.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 if (IsBrowserStartupComplete()) { | 200 if (IsBrowserStartupComplete()) { |
| 201 task_runner->PostTask(from_here, task); | 201 task_runner->PostTask(from_here, task); |
| 202 return; | 202 return; |
| 203 } | 203 } |
| 204 | 204 |
| 205 scoped_ptr<AfterStartupTask> queued_task( | 205 scoped_ptr<AfterStartupTask> queued_task( |
| 206 new AfterStartupTask(from_here, task_runner, task)); | 206 new AfterStartupTask(from_here, task_runner, task)); |
| 207 QueueTask(queued_task.Pass()); | 207 QueueTask(queued_task.Pass()); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void AfterStartupTaskUtils::SetBrowserStartupIsCompleteForTesting() { |
| 211 ::SetBrowserStartupIsComplete(); |
| 212 } |
| 213 |
| 210 void AfterStartupTaskUtils::SetBrowserStartupIsComplete() { | 214 void AfterStartupTaskUtils::SetBrowserStartupIsComplete() { |
| 211 ::SetBrowserStartupIsComplete(); | 215 ::SetBrowserStartupIsComplete(); |
| 212 } | 216 } |
| 213 | 217 |
| 214 bool AfterStartupTaskUtils::IsBrowserStartupComplete() { | 218 bool AfterStartupTaskUtils::IsBrowserStartupComplete() { |
| 215 return ::IsBrowserStartupComplete(); | 219 return ::IsBrowserStartupComplete(); |
| 216 } | 220 } |
| 217 | 221 |
| 218 void AfterStartupTaskUtils::UnsafeResetForTesting() { | 222 void AfterStartupTaskUtils::UnsafeResetForTesting() { |
| 219 DCHECK(g_after_startup_tasks.Get().empty()); | 223 DCHECK(g_after_startup_tasks.Get().empty()); |
| 220 if (!IsBrowserStartupComplete()) | 224 if (!IsBrowserStartupComplete()) |
| 221 return; | 225 return; |
| 222 g_startup_complete_flag.Get().UnsafeResetForTesting(); | 226 g_startup_complete_flag.Get().UnsafeResetForTesting(); |
| 223 DCHECK(!IsBrowserStartupComplete()); | 227 DCHECK(!IsBrowserStartupComplete()); |
| 224 } | 228 } |
| OLD | NEW |