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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 BrowserProcessImpl::~BrowserProcessImpl() { | 196 BrowserProcessImpl::~BrowserProcessImpl() { |
197 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); | 197 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); |
198 | 198 |
199 g_browser_process = NULL; | 199 g_browser_process = NULL; |
200 } | 200 } |
201 | 201 |
202 void BrowserProcessImpl::StartTearDown() { | 202 void BrowserProcessImpl::StartTearDown() { |
203 TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); | 203 TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); |
204 // We need to shutdown the SdchDictionaryFetcher as it regularly holds | |
205 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do | |
206 // a PostDelayedTask onto the IO thread. This shutdown call will both discard | |
207 // any pending URLFetchers, and avoid creating any more. | |
208 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | |
209 base::Bind(&SdchDictionaryFetcher::Shutdown)); | |
210 | |
211 // We need to destroy the MetricsServicesManager, IntranetRedirectDetector, | 204 // We need to destroy the MetricsServicesManager, IntranetRedirectDetector, |
212 // PromoResourceService, and SafeBrowsing ClientSideDetectionService (owned by | 205 // PromoResourceService, and SafeBrowsing ClientSideDetectionService (owned by |
213 // the SafeBrowsingService) before the io_thread_ gets destroyed, since their | 206 // the SafeBrowsingService) before the io_thread_ gets destroyed, since their |
214 // destructors can call the URLFetcher destructor, which does a | 207 // destructors can call the URLFetcher destructor, which does a |
215 // PostDelayedTask operation on the IO thread. (The IO thread will handle that | 208 // PostDelayedTask operation on the IO thread. (The IO thread will handle that |
216 // URLFetcher operation before going away.) | 209 // URLFetcher operation before going away.) |
217 metrics_services_manager_.reset(); | 210 metrics_services_manager_.reset(); |
218 intranet_redirect_detector_.reset(); | 211 intranet_redirect_detector_.reset(); |
219 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 212 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) |
220 if (safe_browsing_service_.get()) | 213 if (safe_browsing_service_.get()) |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 } | 1059 } |
1067 | 1060 |
1068 void BrowserProcessImpl::OnAutoupdateTimer() { | 1061 void BrowserProcessImpl::OnAutoupdateTimer() { |
1069 if (CanAutorestartForUpdate()) { | 1062 if (CanAutorestartForUpdate()) { |
1070 DLOG(WARNING) << "Detected update. Restarting browser."; | 1063 DLOG(WARNING) << "Detected update. Restarting browser."; |
1071 RestartBackgroundInstance(); | 1064 RestartBackgroundInstance(); |
1072 } | 1065 } |
1073 } | 1066 } |
1074 | 1067 |
1075 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1068 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |