| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // WebContentsObserver overrides | 131 // WebContentsObserver overrides |
| 132 void DidFinishLoad(content::RenderFrameHost* render_frame_host, | 132 void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
| 133 const GURL& validated_url) override { | 133 const GURL& validated_url) override { |
| 134 if (!render_frame_host->GetParent()) | 134 if (!render_frame_host->GetParent()) |
| 135 OnStartupComplete(); | 135 OnStartupComplete(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void DidFailLoad(content::RenderFrameHost* render_frame_host, | 138 void DidFailLoad(content::RenderFrameHost* render_frame_host, |
| 139 const GURL& validated_url, | 139 const GURL& validated_url, |
| 140 int error_code, | 140 int error_code, |
| 141 const base::string16& error_description) override { | 141 const base::string16& error_description, |
| 142 bool was_ignored_by_handler) override { |
| 142 if (!render_frame_host->GetParent()) | 143 if (!render_frame_host->GetParent()) |
| 143 OnStartupComplete(); | 144 OnStartupComplete(); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void WebContentsDestroyed() override { OnStartupComplete(); } | 147 void WebContentsDestroyed() override { OnStartupComplete(); } |
| 147 | 148 |
| 148 base::WeakPtrFactory<StartupObserver> weak_factory_; | 149 base::WeakPtrFactory<StartupObserver> weak_factory_; |
| 149 | 150 |
| 150 DISALLOW_COPY_AND_ASSIGN(StartupObserver); | 151 DISALLOW_COPY_AND_ASSIGN(StartupObserver); |
| 151 }; | 152 }; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 return ::IsBrowserStartupComplete(); | 215 return ::IsBrowserStartupComplete(); |
| 215 } | 216 } |
| 216 | 217 |
| 217 void AfterStartupTaskUtils::UnsafeResetForTesting() { | 218 void AfterStartupTaskUtils::UnsafeResetForTesting() { |
| 218 DCHECK(g_after_startup_tasks.Get().empty()); | 219 DCHECK(g_after_startup_tasks.Get().empty()); |
| 219 if (!IsBrowserStartupComplete()) | 220 if (!IsBrowserStartupComplete()) |
| 220 return; | 221 return; |
| 221 g_startup_complete_flag.Get().UnsafeResetForTesting(); | 222 g_startup_complete_flag.Get().UnsafeResetForTesting(); |
| 222 DCHECK(!IsBrowserStartupComplete()); | 223 DCHECK(!IsBrowserStartupComplete()); |
| 223 } | 224 } |
| OLD | NEW |