OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 BrowserProcessImpl::~BrowserProcessImpl() { | 213 BrowserProcessImpl::~BrowserProcessImpl() { |
214 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); | 214 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); |
215 | 215 |
216 g_browser_process = NULL; | 216 g_browser_process = NULL; |
217 } | 217 } |
218 | 218 |
219 void BrowserProcessImpl::StartTearDown() { | 219 void BrowserProcessImpl::StartTearDown() { |
220 TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); | 220 TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); |
221 // We need to shutdown the SdchDictionaryFetcher as it regularly holds | |
222 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do | |
223 // a PostDelayedTask onto the IO thread. This shutdown call will both discard | |
224 // any pending URLFetchers, and avoid creating any more. | |
225 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | |
226 base::Bind(&SdchDictionaryFetcher::Shutdown)); | |
227 | |
228 // We need to destroy the MetricsServicesManager, IntranetRedirectDetector, | 221 // We need to destroy the MetricsServicesManager, IntranetRedirectDetector, |
229 // PromoResourceService, and SafeBrowsing ClientSideDetectionService (owned by | 222 // PromoResourceService, and SafeBrowsing ClientSideDetectionService (owned by |
230 // the SafeBrowsingService) before the io_thread_ gets destroyed, since their | 223 // the SafeBrowsingService) before the io_thread_ gets destroyed, since their |
231 // destructors can call the URLFetcher destructor, which does a | 224 // destructors can call the URLFetcher destructor, which does a |
232 // PostDelayedTask operation on the IO thread. (The IO thread will handle that | 225 // PostDelayedTask operation on the IO thread. (The IO thread will handle that |
233 // URLFetcher operation before going away.) | 226 // URLFetcher operation before going away.) |
234 metrics_services_manager_.reset(); | 227 metrics_services_manager_.reset(); |
235 intranet_redirect_detector_.reset(); | 228 intranet_redirect_detector_.reset(); |
236 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 229 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) |
237 if (safe_browsing_service_.get()) | 230 if (safe_browsing_service_.get()) |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 } | 1108 } |
1116 | 1109 |
1117 void BrowserProcessImpl::OnAutoupdateTimer() { | 1110 void BrowserProcessImpl::OnAutoupdateTimer() { |
1118 if (CanAutorestartForUpdate()) { | 1111 if (CanAutorestartForUpdate()) { |
1119 DLOG(WARNING) << "Detected update. Restarting browser."; | 1112 DLOG(WARNING) << "Detected update. Restarting browser."; |
1120 RestartBackgroundInstance(); | 1113 RestartBackgroundInstance(); |
1121 } | 1114 } |
1122 } | 1115 } |
1123 | 1116 |
1124 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1117 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |