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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/gpu/gpu_mode_manager.h" | 42 #include "chrome/browser/gpu/gpu_mode_manager.h" |
43 #include "chrome/browser/icon_manager.h" | 43 #include "chrome/browser/icon_manager.h" |
44 #include "chrome/browser/idle.h" | 44 #include "chrome/browser/idle.h" |
45 #include "chrome/browser/intranet_redirect_detector.h" | 45 #include "chrome/browser/intranet_redirect_detector.h" |
46 #include "chrome/browser/io_thread.h" | 46 #include "chrome/browser/io_thread.h" |
47 #include "chrome/browser/lifetime/application_lifetime.h" | 47 #include "chrome/browser/lifetime/application_lifetime.h" |
48 #include "chrome/browser/metrics/metrics_services_manager.h" | 48 #include "chrome/browser/metrics/metrics_services_manager.h" |
49 #include "chrome/browser/metrics/thread_watcher.h" | 49 #include "chrome/browser/metrics/thread_watcher.h" |
50 #include "chrome/browser/net/chrome_net_log.h" | 50 #include "chrome/browser/net/chrome_net_log.h" |
51 #include "chrome/browser/net/crl_set_fetcher.h" | 51 #include "chrome/browser/net/crl_set_fetcher.h" |
52 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | |
53 #include "chrome/browser/notifications/notification_ui_manager.h" | 52 #include "chrome/browser/notifications/notification_ui_manager.h" |
54 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 53 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
55 #include "chrome/browser/plugins/plugin_finder.h" | 54 #include "chrome/browser/plugins/plugin_finder.h" |
56 #include "chrome/browser/prefs/browser_prefs.h" | 55 #include "chrome/browser/prefs/browser_prefs.h" |
57 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 56 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
58 #include "chrome/browser/prerender/prerender_tracker.h" | 57 #include "chrome/browser/prerender/prerender_tracker.h" |
59 #include "chrome/browser/printing/background_printing_manager.h" | 58 #include "chrome/browser/printing/background_printing_manager.h" |
60 #include "chrome/browser/printing/print_job_manager.h" | 59 #include "chrome/browser/printing/print_job_manager.h" |
61 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 60 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
62 #include "chrome/browser/profiles/profile_manager.h" | 61 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 210 } |
212 | 211 |
213 BrowserProcessImpl::~BrowserProcessImpl() { | 212 BrowserProcessImpl::~BrowserProcessImpl() { |
214 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); | 213 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); |
215 | 214 |
216 g_browser_process = NULL; | 215 g_browser_process = NULL; |
217 } | 216 } |
218 | 217 |
219 void BrowserProcessImpl::StartTearDown() { | 218 void BrowserProcessImpl::StartTearDown() { |
220 TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); | 219 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, | 220 // We need to destroy the MetricsServicesManager, IntranetRedirectDetector, |
229 // PromoResourceService, and SafeBrowsing ClientSideDetectionService (owned by | 221 // PromoResourceService, and SafeBrowsing ClientSideDetectionService (owned by |
230 // the SafeBrowsingService) before the io_thread_ gets destroyed, since their | 222 // the SafeBrowsingService) before the io_thread_ gets destroyed, since their |
231 // destructors can call the URLFetcher destructor, which does a | 223 // destructors can call the URLFetcher destructor, which does a |
232 // PostDelayedTask operation on the IO thread. (The IO thread will handle that | 224 // PostDelayedTask operation on the IO thread. (The IO thread will handle that |
233 // URLFetcher operation before going away.) | 225 // URLFetcher operation before going away.) |
234 metrics_services_manager_.reset(); | 226 metrics_services_manager_.reset(); |
235 intranet_redirect_detector_.reset(); | 227 intranet_redirect_detector_.reset(); |
236 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 228 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) |
237 if (safe_browsing_service_.get()) | 229 if (safe_browsing_service_.get()) |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 } | 1107 } |
1116 | 1108 |
1117 void BrowserProcessImpl::OnAutoupdateTimer() { | 1109 void BrowserProcessImpl::OnAutoupdateTimer() { |
1118 if (CanAutorestartForUpdate()) { | 1110 if (CanAutorestartForUpdate()) { |
1119 DLOG(WARNING) << "Detected update. Restarting browser."; | 1111 DLOG(WARNING) << "Detected update. Restarting browser."; |
1120 RestartBackgroundInstance(); | 1112 RestartBackgroundInstance(); |
1121 } | 1113 } |
1122 } | 1114 } |
1123 | 1115 |
1124 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1116 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |