OLD | NEW |
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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "base/thread_restrictions.h" | |
16 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/browser_thread.h" | 16 #include "chrome/browser/browser_thread.h" |
18 #include "chrome/browser/gpu_process_host.h" | 17 #include "chrome/browser/gpu_process_host.h" |
19 #include "chrome/browser/net/chrome_net_log.h" | 18 #include "chrome/browser/net/chrome_net_log.h" |
20 #include "chrome/browser/net/chrome_url_request_context.h" | 19 #include "chrome/browser/net/chrome_url_request_context.h" |
21 #include "chrome/browser/net/connect_interceptor.h" | 20 #include "chrome/browser/net/connect_interceptor.h" |
22 #include "chrome/browser/net/passive_log_collector.h" | 21 #include "chrome/browser/net/passive_log_collector.h" |
23 #include "chrome/browser/net/predictor_api.h" | 22 #include "chrome/browser/net/predictor_api.h" |
24 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/net/url_fetcher.h" | 24 #include "chrome/common/net/url_fetcher.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 this, | 250 this, |
252 &IOThread::ChangedToOnTheRecordOnIOThread)); | 251 &IOThread::ChangedToOnTheRecordOnIOThread)); |
253 } | 252 } |
254 | 253 |
255 net::ProxyScriptFetcher* IOThread::CreateAndRegisterProxyScriptFetcher( | 254 net::ProxyScriptFetcher* IOThread::CreateAndRegisterProxyScriptFetcher( |
256 URLRequestContext* url_request_context) { | 255 URLRequestContext* url_request_context) { |
257 return new ManagedProxyScriptFetcher(url_request_context, this); | 256 return new ManagedProxyScriptFetcher(url_request_context, this); |
258 } | 257 } |
259 | 258 |
260 void IOThread::Init() { | 259 void IOThread::Init() { |
261 #if defined(OS_LINUX) | |
262 // TODO(evan): test and enable this on all platforms. | |
263 // Though this thread is called the "IO" thread, it actually just routes | |
264 // messages around; it shouldn't be allowed to perform any blocking disk I/O. | |
265 base::ThreadRestrictions::SetIOAllowed(false); | |
266 #endif | |
267 | |
268 BrowserProcessSubThread::Init(); | 260 BrowserProcessSubThread::Init(); |
269 | 261 |
270 DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type()); | 262 DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type()); |
271 | 263 |
272 #if defined(USE_NSS) | 264 #if defined(USE_NSS) |
273 net::SetMessageLoopForOCSP(); | 265 net::SetMessageLoopForOCSP(); |
274 #endif // defined(USE_NSS) | 266 #endif // defined(USE_NSS) |
275 | 267 |
276 DCHECK(!globals_); | 268 DCHECK(!globals_); |
277 globals_ = new Globals; | 269 globals_ = new Globals; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 net::HostCache* host_cache = | 446 net::HostCache* host_cache = |
455 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 447 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
456 if (host_cache) | 448 if (host_cache) |
457 host_cache->clear(); | 449 host_cache->clear(); |
458 } | 450 } |
459 // Clear all of the passively logged data. | 451 // Clear all of the passively logged data. |
460 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 452 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
461 // clear the data pertaining to off the record context. | 453 // clear the data pertaining to off the record context. |
462 globals_->net_log->passive_collector()->Clear(); | 454 globals_->net_log->passive_collector()->Clear(); |
463 } | 455 } |
OLD | NEW |