diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-22 17:46:27 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-22 17:46:27 +0000 |
commit | 0ac8368b361a5edbcfe4b985131a8eec13304f49 (patch) | |
tree | fbc7e4bdb86150f112730932c0d9d97fab16f4e0 /chrome/browser/io_thread.h | |
parent | 290da7ba0368e3cf1dbbe214a5be9f89666954d0 (diff) | |
download | chromium_src-0ac8368b361a5edbcfe4b985131a8eec13304f49.zip chromium_src-0ac8368b361a5edbcfe4b985131a8eec13304f49.tar.gz chromium_src-0ac8368b361a5edbcfe4b985131a8eec13304f49.tar.bz2 |
Pull IOThread out of BrowserProcessImpl. Move the dns prefetching initialization into IOThread.
The global host resolver and dns master have changed to be member variables of IOThread.
BUG=26156,26159
Review URL: http://codereview.chromium.org/553026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36866 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.h')
-rw-r--r-- | chrome/browser/io_thread.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h new file mode 100644 index 0000000..f93f748 --- /dev/null +++ b/chrome/browser/io_thread.h @@ -0,0 +1,70 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_IO_THREAD_H_ +#define CHROME_BROWSER_IO_THREAD_H_ + +#include "base/basictypes.h" +#include "base/task.h" +#include "chrome/browser/browser_process_sub_thread.h" +#include "chrome/common/net/dns.h" +#include "net/base/host_resolver.h" + +class ListValue; + +namespace chrome_browser_net { +class DnsMaster; +} // namespace chrome_browser_net + +class IOThread : public BrowserProcessSubThread { + public: + IOThread(); + + virtual ~IOThread(); + + net::HostResolver* host_resolver(); + + // Initializes the DnsMaster. |prefetching_enabled| indicates whether or + // not dns prefetching should be enabled. This should be called by the UI + // thread. It will post a task to the IO thread to perform the actual + // initialization. + void InitDnsMaster(bool prefetching_enabled, + base::TimeDelta max_queue_delay, + size_t max_concurrent, + const chrome_common_net::NameList& hostnames_to_prefetch, + ListValue* referral_list); + + // Handles changing to On The Record mode. Posts a task for this onto the + // IOThread's message loop. + void ChangedToOnTheRecord(); + + protected: + virtual void Init(); + virtual void CleanUp(); + + private: + void InitDnsMasterOnIOThread( + bool prefetching_enabled, + base::TimeDelta max_queue_delay, + size_t max_concurrent, + chrome_common_net::NameList hostnames_to_prefetch, + ListValue* referral_list); + + void ChangedToOnTheRecordOnIOThread(); + + // 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(). + + net::HostResolver* host_resolver_; + + net::HostResolver::Observer* prefetch_observer_; + chrome_browser_net::DnsMaster* dns_master_; + + DISALLOW_COPY_AND_ASSIGN(IOThread); +}; + +#endif // CHROME_BROWSER_IO_THREAD_H_ |