Chromium Code Reviews| Index: chrome/browser/io_thread.cc |
| =================================================================== |
| --- chrome/browser/io_thread.cc (revision 65207) |
| +++ chrome/browser/io_thread.cc (working copy) |
| @@ -206,8 +206,9 @@ |
| IOThread::Globals::~Globals() {} |
| -IOThread::IOThread() |
| - : BrowserProcessSubThread(BrowserThread::IO), |
| +IOThread::IOThread(ChromeNetLog* net_log) |
| + : net_log_(net_log), |
|
eroman
2010/11/17 05:59:02
I am not sure what the style guide says, but I thi
mmenke
2010/11/17 21:42:14
Done.
|
| + BrowserProcessSubThread(BrowserThread::IO), |
| globals_(NULL), |
| speculative_interceptor_(NULL), |
| predictor_(NULL) {} |
| @@ -224,6 +225,10 @@ |
| return globals_; |
| } |
| +ChromeNetLog* IOThread::net_log() { |
| + return net_log_; |
| +} |
| + |
| void IOThread::InitNetworkPredictor( |
| bool prefetching_enabled, |
| base::TimeDelta max_dns_queue_delay, |
| @@ -275,16 +280,14 @@ |
| DCHECK(!globals_); |
| globals_ = new Globals; |
| - globals_->net_log.reset(new ChromeNetLog()); |
| - |
| // Add an observer that will emit network change events to the ChromeNetLog. |
| // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
| // logging the network change before other IO thread consumers respond to it. |
| network_change_observer_.reset( |
| - new LoggingNetworkChangeObserver(globals_->net_log.get())); |
| + new LoggingNetworkChangeObserver(net_log_)); |
| globals_->host_resolver.reset( |
| - CreateGlobalHostResolver(globals_->net_log.get())); |
| + CreateGlobalHostResolver(net_log_)); |
| globals_->dnsrr_resolver.reset(new net::DnsRRResolver); |
| globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
| globals_->host_resolver.get())); |
| @@ -332,10 +335,6 @@ |
| (*it)->Cancel(); |
| } |
| - // We will delete the NetLog as part of CleanUpAfterMessageLoopDestruction() |
| - // in case any of the message loop destruction observers try to access it. |
| - deferred_net_log_to_delete_.reset(globals_->net_log.release()); |
| - |
| delete globals_; |
| globals_ = NULL; |
| @@ -343,11 +342,6 @@ |
| } |
| void IOThread::CleanUpAfterMessageLoopDestruction() { |
| - // TODO(eroman): get rid of this special case for 39723. If we could instead |
| - // have a method that runs after the message loop destruction obsevers have |
| - // run, but before the message loop itself is destroyed, we could safely |
| - // combine the two cleanups. |
| - deferred_net_log_to_delete_.reset(); |
| BrowserProcessSubThread::CleanUpAfterMessageLoopDestruction(); |
| // URLRequest instances must NOT outlive the IO thread. |
| @@ -440,5 +434,5 @@ |
| // Clear all of the passively logged data. |
| // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| // clear the data pertaining to off the record context. |
| - globals_->net_log->passive_collector()->Clear(); |
| + net_log_->passive_collector()->Clear(); |
| } |