Chromium Code Reviews| Index: chrome/browser/browser_process_impl.cc |
| diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc |
| index b7d11153c96e25d69122fe0994347bb4ffdfdf4f..a70687c933b246d60ac21669a19e6b4707af1c6d 100644 |
| --- a/chrome/browser/browser_process_impl.cc |
| +++ b/chrome/browser/browser_process_impl.cc |
| @@ -34,6 +34,8 @@ |
| #include "chrome/browser/metrics/metrics_service.h" |
| #include "chrome/browser/net/chrome_net_log.h" |
| #include "chrome/browser/net/predictor_api.h" |
| +#include "chrome/browser/net/pref_proxy_config_service.h" |
| +#include "chrome/browser/net/proxy_service_factory.h" |
| #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| #include "chrome/browser/notifications/notification_ui_manager.h" |
| #include "chrome/browser/plugin_data_remover.h" |
| @@ -57,6 +59,7 @@ |
| #include "chrome/common/extensions/extension_resource.h" |
| #include "chrome/common/extensions/extension_l10n_util.h" |
| #include "chrome/common/json_pref_store.h" |
| +#include "chrome/common/net/url_request_context_getter.h" |
| #include "chrome/common/notification_service.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| @@ -199,6 +202,10 @@ BrowserProcessImpl::~BrowserProcessImpl() { |
| // Wait for removing plugin data to finish before shutting down the IO thread. |
| WaitForPluginDataRemoverToFinish(); |
| + // Give up reference before io_thread_ checks that there is no one left |
| + // holding a reference. |
| + system_request_context_ = NULL; |
| + |
| // Need to stop io_thread_ before resource_dispatcher_host_, since |
| // io_thread_ may still deref ResourceDispatcherHost and handle resource |
| // request before going away. |
| @@ -245,6 +252,12 @@ BrowserProcessImpl::~BrowserProcessImpl() { |
| // on the db thread too. |
| db_thread_.reset(); |
| + // Need to destroy PrefProxyConfigTracker before local state, since it |
| + // caches a pointer to local state. |
| + if (pref_proxy_config_tracker_) |
| + pref_proxy_config_tracker_->DetachFromPrefService(); |
| + pref_proxy_config_tracker_ = NULL; |
| + |
| // At this point, no render process exist and the file, io, db, and |
| // webkit threads in this process have all terminated, so it's safe |
| // to access local state data such as cookies, database, or local storage. |
| @@ -423,6 +436,21 @@ ui::Clipboard* BrowserProcessImpl::clipboard() { |
| return clipboard_.get(); |
| } |
| +PrefProxyConfigTracker* BrowserProcessImpl::pref_proxy_config_tracker() { |
| + DCHECK(CalledOnValidThread()); |
| + if (!created_pref_proxy_config_tracker_) |
| + CreatePrefProxyConfigTracker(); |
| + return pref_proxy_config_tracker_.get(); |
| +} |
| + |
| +scoped_refptr<URLRequestContextGetter> |
| + BrowserProcessImpl::system_request_context() { |
| + DCHECK(CalledOnValidThread()); |
| + if (!created_system_request_context_) |
| + CreateSystemRequestContextGetter(); |
| + return system_request_context_.get(); |
| +} |
| + |
| NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { |
| DCHECK(CalledOnValidThread()); |
| if (!created_notification_ui_manager_) |
| @@ -833,6 +861,27 @@ void BrowserProcessImpl::CreateSafeBrowsingDetectionService() { |
| } |
| } |
| +void BrowserProcessImpl::CreatePrefProxyConfigTracker() { |
| + DCHECK(pref_proxy_config_tracker_.get() == NULL); |
| + created_pref_proxy_config_tracker_ = true; |
| + pref_proxy_config_tracker_ = new PrefProxyConfigTracker(local_state()); |
| +} |
| + |
| +void BrowserProcessImpl::CreateSystemRequestContextGetter() { |
| + DCHECK(system_request_context_.get() == NULL); |
| + created_system_request_context_ = true; |
| + |
| + net::ProxyConfigService* config_service = |
|
willchan no longer on Chromium
2011/02/16 20:02:27
There's also a SSLConfigService, so can you name t
battre
2011/02/21 17:27:57
Done.
|
| + ProxyServiceFactory::CreateProxyConfigService( |
| + io_thread()->message_loop(), file_thread()->message_loop(), |
| + pref_proxy_config_tracker()); |
| + |
| + // Takes ownership of config_service. |
| + io_thread()->SetSystemProxyConfigService(config_service); |
| + |
| + system_request_context_ = io_thread()->system_url_request_context_getter(); |
|
willchan no longer on Chromium
2011/02/16 20:02:27
Don't cache the pointer here. We want the IOThread
battre
2011/02/21 17:27:57
Done.
|
| +} |
| + |
| bool BrowserProcessImpl::IsSafeBrowsingDetectionServiceEnabled() { |
| // The safe browsing client-side detection is enabled only if the switch is |
| // enabled and when safe browsing related stats is allowed to be collected. |