diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 15:19:40 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 15:19:40 +0000 |
commit | b2fcd0e0c8850eda2135b6fe270af5f453682f23 (patch) | |
tree | 2858497a3551d59093a5dfd233bf3550d40a4e8d /chrome/browser/io_thread.h | |
parent | 087a03f6aeded6397081304e191b1ac027b8e134 (diff) | |
download | chromium_src-b2fcd0e0c8850eda2135b6fe270af5f453682f23.zip chromium_src-b2fcd0e0c8850eda2135b6fe270af5f453682f23.tar.gz chromium_src-b2fcd0e0c8850eda2135b6fe270af5f453682f23.tar.bz2 |
Update NetLog to be threadsafe.
The ChromeNetLog is now owned by the browser process,
and passed to the IOThread on creation.
NetLog entries can be added from any thread.
Observers must be able to handle having log entries added
from any thread. Observers can add/remove themselves on any
thread.
BUG=63334
TEST=None, yet
Review URL: http://codereview.chromium.org/4118004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.h')
-rw-r--r-- | chrome/browser/io_thread.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index a2dad58..3443af1 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -43,7 +43,6 @@ class IOThread : public BrowserProcessSubThread { Globals(); ~Globals(); - scoped_ptr<ChromeNetLog> net_log; scoped_ptr<net::HostResolver> host_resolver; scoped_ptr<net::DnsRRResolver> dnsrr_resolver; scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; @@ -51,13 +50,16 @@ class IOThread : public BrowserProcessSubThread { ChromeNetworkDelegate network_delegate; }; - explicit IOThread(PrefService* local_state); + // |net_log| must either outlive the IOThread or be NULL. + IOThread(PrefService* local_state, ChromeNetLog* net_log); virtual ~IOThread(); // Can only be called on the IO thread. Globals* globals(); + ChromeNetLog* net_log(); + // Initializes the network predictor, which induces DNS pre-resolution and/or // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS // prefetching should be enabled, and |preconnect_enabled| controls whether @@ -120,22 +122,20 @@ class IOThread : public BrowserProcessSubThread { void ChangedToOnTheRecordOnIOThread(); + // The NetLog is owned by the browser process, to allow logging from other + // threads during shutdown, but is used most frequently on the IOThread. + ChromeNetLog* net_log_; + // 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(), except ChromeNetLog - // which is deleted later in CleanUpAfterMessageLoopDestruction(). + // 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_; - // This variable is only meaningful during shutdown. It is used to defer - // deletion of the NetLog to CleanUpAfterMessageLoopDestruction() even - // though |globals_| is reset by CleanUp(). - scoped_ptr<ChromeNetLog> deferred_net_log_to_delete_; - // Observer that logs network changes to the ChromeNetLog. scoped_ptr<net::NetworkChangeNotifier::Observer> network_change_observer_; |