Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 3421039: Revert 60739 (still leaks on ChromiumOS!) - Reland r59972: Eagerly set the IO... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/net/chrome_url_request_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/leak_tracker.h" 8 #include "base/leak_tracker.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/string_split.h" 11 #include "base/string_split.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_thread.h" 14 #include "chrome/browser/chrome_thread.h"
15 #include "chrome/browser/gpu_process_host.h" 15 #include "chrome/browser/gpu_process_host.h"
16 #include "chrome/browser/net/chrome_net_log.h" 16 #include "chrome/browser/net/chrome_net_log.h"
17 #include "chrome/browser/net/predictor_api.h" 17 #include "chrome/browser/net/predictor_api.h"
18 #include "chrome/browser/net/passive_log_collector.h" 18 #include "chrome/browser/net/passive_log_collector.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/net/url_fetcher.h" 20 #include "chrome/common/net/url_fetcher.h"
21 #include "net/base/mapped_host_resolver.h" 21 #include "net/base/mapped_host_resolver.h"
22 #include "net/base/host_cache.h" 22 #include "net/base/host_cache.h"
23 #include "net/base/host_resolver.h" 23 #include "net/base/host_resolver.h"
24 #include "net/base/host_resolver_impl.h" 24 #include "net/base/host_resolver_impl.h"
25 #include "net/base/net_util.h" 25 #include "net/base/net_util.h"
26 #include "net/http/http_auth_filter.h" 26 #include "net/http/http_auth_filter.h"
27 #include "net/http/http_auth_handler_factory.h" 27 #include "net/http/http_auth_handler_factory.h"
28 #if defined(USE_NSS)
29 #include "net/ocsp/nss_ocsp.h"
30 #endif // defined(USE_NSS)
31 28
32 namespace { 29 namespace {
33 30
34 net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { 31 net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) {
35 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 32 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
36 33
37 size_t parallelism = net::HostResolver::kDefaultParallelism; 34 size_t parallelism = net::HostResolver::kDefaultParallelism;
38 35
39 // Use the concurrency override from the command-line, if any. 36 // Use the concurrency override from the command-line, if any.
40 if (command_line.HasSwitch(switches::kHostResolverParallelism)) { 37 if (command_line.HasSwitch(switches::kHostResolverParallelism)) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 message_loop()->PostTask( 151 message_loop()->PostTask(
155 FROM_HERE, 152 FROM_HERE,
156 NewRunnableMethod( 153 NewRunnableMethod(
157 this, 154 this,
158 &IOThread::ChangedToOnTheRecordOnIOThread)); 155 &IOThread::ChangedToOnTheRecordOnIOThread));
159 } 156 }
160 157
161 void IOThread::Init() { 158 void IOThread::Init() {
162 BrowserProcessSubThread::Init(); 159 BrowserProcessSubThread::Init();
163 160
164 DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type());
165
166 #if defined(USE_NSS)
167 net::SetMessageLoopForOCSP();
168 #endif // defined(USE_NSS)
169
170 DCHECK(!globals_); 161 DCHECK(!globals_);
171 globals_ = new Globals; 162 globals_ = new Globals;
172 163
173 globals_->net_log.reset(new ChromeNetLog()); 164 globals_->net_log.reset(new ChromeNetLog());
174 165
175 // Add an observer that will emit network change events to the ChromeNetLog. 166 // Add an observer that will emit network change events to the ChromeNetLog.
176 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be 167 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be
177 // logging the network change before other IO thread consumers respond to it. 168 // logging the network change before other IO thread consumers respond to it.
178 network_change_observer_.reset( 169 network_change_observer_.reset(
179 new LoggingNetworkChangeObserver(globals_->net_log.get())); 170 new LoggingNetworkChangeObserver(globals_->net_log.get()));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 net::HostCache* host_cache = 306 net::HostCache* host_cache =
316 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); 307 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache();
317 if (host_cache) 308 if (host_cache)
318 host_cache->clear(); 309 host_cache->clear();
319 } 310 }
320 // Clear all of the passively logged data. 311 // Clear all of the passively logged data.
321 // TODO(eroman): this is a bit heavy handed, really all we need to do is 312 // TODO(eroman): this is a bit heavy handed, really all we need to do is
322 // clear the data pertaining to off the record context. 313 // clear the data pertaining to off the record context.
323 globals_->net_log->passive_collector()->Clear(); 314 globals_->net_log->passive_collector()->Clear();
324 } 315 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/net/chrome_url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698