| 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 <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/download/download_request_limiter.h" | 29 #include "chrome/browser/download/download_request_limiter.h" |
| 30 #include "chrome/browser/download/download_status_updater.h" | 30 #include "chrome/browser/download/download_status_updater.h" |
| 31 #include "chrome/browser/extensions/extension_event_router_forwarder.h" | 31 #include "chrome/browser/extensions/extension_event_router_forwarder.h" |
| 32 #include "chrome/browser/extensions/extension_tab_id_map.h" | 32 #include "chrome/browser/extensions/extension_tab_id_map.h" |
| 33 #include "chrome/browser/first_run/upgrade_util.h" | 33 #include "chrome/browser/first_run/upgrade_util.h" |
| 34 #include "chrome/browser/icon_manager.h" | 34 #include "chrome/browser/icon_manager.h" |
| 35 #include "chrome/browser/intranet_redirect_detector.h" | 35 #include "chrome/browser/intranet_redirect_detector.h" |
| 36 #include "chrome/browser/io_thread.h" | 36 #include "chrome/browser/io_thread.h" |
| 37 #include "chrome/browser/metrics/metrics_service.h" | 37 #include "chrome/browser/metrics/metrics_service.h" |
| 38 #include "chrome/browser/metrics/thread_watcher.h" | 38 #include "chrome/browser/metrics/thread_watcher.h" |
| 39 #include "chrome/browser/metrics/variations_service.h" |
| 39 #include "chrome/browser/net/chrome_net_log.h" | 40 #include "chrome/browser/net/chrome_net_log.h" |
| 40 #include "chrome/browser/net/crl_set_fetcher.h" | 41 #include "chrome/browser/net/crl_set_fetcher.h" |
| 41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 42 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 42 #include "chrome/browser/notifications/notification_ui_manager.h" | 43 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 43 #include "chrome/browser/policy/browser_policy_connector.h" | 44 #include "chrome/browser/policy/browser_policy_connector.h" |
| 44 #include "chrome/browser/policy/policy_service_impl.h" | 45 #include "chrome/browser/policy/policy_service_impl.h" |
| 45 #include "chrome/browser/policy/policy_service_stub.h" | 46 #include "chrome/browser/policy/policy_service_stub.h" |
| 46 #include "chrome/browser/prefs/browser_prefs.h" | 47 #include "chrome/browser/prefs/browser_prefs.h" |
| 47 #include "chrome/browser/prefs/pref_service.h" | 48 #include "chrome/browser/prefs/pref_service.h" |
| 48 #include "chrome/browser/prerender/prerender_tracker.h" | 49 #include "chrome/browser/prerender/prerender_tracker.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 automation_provider_list_.reset(); | 179 automation_provider_list_.reset(); |
| 179 #endif | 180 #endif |
| 180 | 181 |
| 181 // We need to shutdown the SdchDictionaryFetcher as it regularly holds | 182 // We need to shutdown the SdchDictionaryFetcher as it regularly holds |
| 182 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do | 183 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do |
| 183 // a PostDelayedTask onto the IO thread. This shutdown call will both discard | 184 // a PostDelayedTask onto the IO thread. This shutdown call will both discard |
| 184 // any pending URLFetchers, and avoid creating any more. | 185 // any pending URLFetchers, and avoid creating any more. |
| 185 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 186 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 186 base::Bind(&SdchDictionaryFetcher::Shutdown)); | 187 base::Bind(&SdchDictionaryFetcher::Shutdown)); |
| 187 | 188 |
| 188 // We need to destroy the MetricsService, IntranetRedirectDetector, and | 189 // We need to destroy the MetricsService, VariationsService, |
| 189 // SafeBrowsing ClientSideDetectionService (owned by the SafeBrowsingService) | 190 // IntranetRedirectDetector, and SafeBrowsing ClientSideDetectionService |
| 190 // before the io_thread_ gets destroyed, since their destructors can call the | 191 // (owned by the SafeBrowsingService) before the io_thread_ gets destroyed, |
| 191 // URLFetcher destructor, which does a PostDelayedTask operation on the IO | 192 // since their destructors can call the URLFetcher destructor, which does a |
| 192 // thread. (The IO thread will handle that URLFetcher operation before going | 193 // PostDelayedTask operation on the IO thread. (The IO thread will handle that |
| 193 // away.) | 194 // URLFetcher operation before going away.) |
| 194 metrics_service_.reset(); | 195 metrics_service_.reset(); |
| 196 variations_service_.reset(); |
| 195 intranet_redirect_detector_.reset(); | 197 intranet_redirect_detector_.reset(); |
| 196 #if defined(ENABLE_SAFE_BROWSING) | 198 #if defined(ENABLE_SAFE_BROWSING) |
| 197 if (safe_browsing_service_.get()) { | 199 if (safe_browsing_service_.get()) { |
| 198 safe_browsing_service()->ShutDown(); | 200 safe_browsing_service()->ShutDown(); |
| 199 } | 201 } |
| 200 #endif | 202 #endif |
| 201 | 203 |
| 202 // Need to clear the desktop notification balloons before the io_thread_ and | 204 // Need to clear the desktop notification balloons before the io_thread_ and |
| 203 // before the profiles, since if there are any still showing we will access | 205 // before the profiles, since if there are any still showing we will access |
| 204 // those things during teardown. | 206 // those things during teardown. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 ui::Clipboard* BrowserProcessImpl::clipboard() { | 390 ui::Clipboard* BrowserProcessImpl::clipboard() { |
| 389 DCHECK(CalledOnValidThread()); | 391 DCHECK(CalledOnValidThread()); |
| 390 return clipboard_.get(); | 392 return clipboard_.get(); |
| 391 } | 393 } |
| 392 | 394 |
| 393 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { | 395 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { |
| 394 DCHECK(CalledOnValidThread()); | 396 DCHECK(CalledOnValidThread()); |
| 395 return io_thread()->system_url_request_context_getter(); | 397 return io_thread()->system_url_request_context_getter(); |
| 396 } | 398 } |
| 397 | 399 |
| 400 VariationsService* BrowserProcessImpl::variations_service() { |
| 401 DCHECK(CalledOnValidThread()); |
| 402 if (!variations_service_.get()) |
| 403 variations_service_.reset(new VariationsService()); |
| 404 return variations_service_.get(); |
| 405 } |
| 406 |
| 398 #if defined(OS_CHROMEOS) | 407 #if defined(OS_CHROMEOS) |
| 399 chromeos::OomPriorityManager* BrowserProcessImpl::oom_priority_manager() { | 408 chromeos::OomPriorityManager* BrowserProcessImpl::oom_priority_manager() { |
| 400 DCHECK(CalledOnValidThread()); | 409 DCHECK(CalledOnValidThread()); |
| 401 if (!oom_priority_manager_.get()) | 410 if (!oom_priority_manager_.get()) |
| 402 oom_priority_manager_.reset(new chromeos::OomPriorityManager()); | 411 oom_priority_manager_.reset(new chromeos::OomPriorityManager()); |
| 403 return oom_priority_manager_.get(); | 412 return oom_priority_manager_.get(); |
| 404 } | 413 } |
| 405 #endif // defined(OS_CHROMEOS) | 414 #endif // defined(OS_CHROMEOS) |
| 406 | 415 |
| 407 ExtensionEventRouterForwarder* | 416 ExtensionEventRouterForwarder* |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 } | 925 } |
| 917 | 926 |
| 918 void BrowserProcessImpl::OnAutoupdateTimer() { | 927 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 919 if (CanAutorestartForUpdate()) { | 928 if (CanAutorestartForUpdate()) { |
| 920 DLOG(WARNING) << "Detected update. Restarting browser."; | 929 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 921 RestartBackgroundInstance(); | 930 RestartBackgroundInstance(); |
| 922 } | 931 } |
| 923 } | 932 } |
| 924 | 933 |
| 925 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 934 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |