diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 00:24:51 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 00:24:51 +0000 |
commit | d13c32787737f1822202802f062c41c38b90e5f5 (patch) | |
tree | f616a6dcf08fee7cc6f5c023e53be4fa501e9ef2 /chrome/browser/io_thread.h | |
parent | 9becad4ad1adcd4e4339b45f8b90d299fd968a08 (diff) | |
download | chromium_src-d13c32787737f1822202802f062c41c38b90e5f5.zip chromium_src-d13c32787737f1822202802f062c41c38b90e5f5.tar.gz chromium_src-d13c32787737f1822202802f062c41c38b90e5f5.tar.bz2 |
Pass the NetworkChangeNotifier to HostResolver.
This requires the following refactors:
(1) NetworkChangeNotifier moves out of HttpNetworkSession into IOThread.
(2) HostResolver gets initialized with NetworkChangeNotifier.
(3) NetworkChangeNotifier needs to get passed into HttpCache and HttpNetworkSession (required updating a lot of files).
(4) NetworkChangeNotifier is no longer reference counted. It is owned by IOThread.
(5) IOThread gains a new struct: Globals. It can only be used on the io thread.
(6) ChromeURLRequestContextFactory uses IOThread::Globals to initialize ChromeURLRequest objects with the host resolver and network change notifier.
BUG=26159
Review URL: http://codereview.chromium.org/552117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38052 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.h')
-rw-r--r-- | chrome/browser/io_thread.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index f93f748..373d118 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -6,6 +6,8 @@ #define CHROME_BROWSER_IO_THREAD_H_ #include "base/basictypes.h" +#include "base/ref_counted.h" +#include "base/scoped_ptr.h" #include "base/task.h" #include "chrome/browser/browser_process_sub_thread.h" #include "chrome/common/net/dns.h" @@ -17,13 +19,25 @@ namespace chrome_browser_net { class DnsMaster; } // namespace chrome_browser_net +namespace net { +class NetworkChangeNotifier; +} // namespace net + class IOThread : public BrowserProcessSubThread { public: + struct Globals { + scoped_ptr<net::NetworkChangeNotifier> network_change_notifier; + // TODO(willchan): Stop reference counting HostResolver. It's owned by + // IOThread now. + scoped_refptr<net::HostResolver> host_resolver; + }; + IOThread(); virtual ~IOThread(); - net::HostResolver* host_resolver(); + // Can only be called on the IO thread. + Globals* globals(); // Initializes the DnsMaster. |prefetching_enabled| indicates whether or // not dns prefetching should be enabled. This should be called by the UI @@ -56,10 +70,15 @@ class IOThread : public BrowserProcessSubThread { // These member variables are basically global, but their lifetimes are tied // to the IOThread. IOThread owns them all, despite not using scoped_ptr. // This is because the destructor of IOThread runs on the wrong thread. All - // member variables should be deleted in CleanUp(). Most of these will be - // initialized in Init(). + // member variables should be deleted in CleanUp(). + + // These member variables are initialized in Init() and do not change for the + // lifetime of the IO thread. + + Globals* globals_; - net::HostResolver* host_resolver_; + // These member variables are initialized by a task posted to the IO thread, + // which gets posted by calling certain member functions of IOThread. net::HostResolver::Observer* prefetch_observer_; chrome_browser_net::DnsMaster* dns_master_; |