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" |
15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/browser_thread.h" | 17 #include "chrome/browser/browser_thread.h" |
17 #include "chrome/browser/gpu_process_host.h" | 18 #include "chrome/browser/gpu_process_host.h" |
18 #include "chrome/browser/net/chrome_net_log.h" | 19 #include "chrome/browser/net/chrome_net_log.h" |
19 #include "chrome/browser/net/connect_interceptor.h" | 20 #include "chrome/browser/net/connect_interceptor.h" |
20 #include "chrome/browser/net/passive_log_collector.h" | 21 #include "chrome/browser/net/passive_log_collector.h" |
21 #include "chrome/browser/net/predictor_api.h" | 22 #include "chrome/browser/net/predictor_api.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/net/url_fetcher.h" | 24 #include "chrome/common/net/url_fetcher.h" |
24 #include "net/base/dnsrr_resolver.h" | 25 #include "net/base/dnsrr_resolver.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 this, | 226 this, |
226 &IOThread::ChangedToOnTheRecordOnIOThread)); | 227 &IOThread::ChangedToOnTheRecordOnIOThread)); |
227 } | 228 } |
228 | 229 |
229 net::ProxyScriptFetcher* IOThread::CreateAndRegisterProxyScriptFetcher( | 230 net::ProxyScriptFetcher* IOThread::CreateAndRegisterProxyScriptFetcher( |
230 URLRequestContext* url_request_context) { | 231 URLRequestContext* url_request_context) { |
231 return new ManagedProxyScriptFetcher(url_request_context, this); | 232 return new ManagedProxyScriptFetcher(url_request_context, this); |
232 } | 233 } |
233 | 234 |
234 void IOThread::Init() { | 235 void IOThread::Init() { |
| 236 #if defined(OS_LINUX) |
| 237 // TODO(evan): test and enable this on all platforms. |
| 238 // Though this thread is called the "IO" thread, it actually just routes |
| 239 // messages around; it shouldn't be allowed to perform any blocking disk I/O. |
| 240 base::ThreadRestrictions::SetIOAllowed(false); |
| 241 #endif |
| 242 |
235 BrowserProcessSubThread::Init(); | 243 BrowserProcessSubThread::Init(); |
236 | 244 |
237 DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type()); | 245 DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type()); |
238 | 246 |
239 #if defined(USE_NSS) | 247 #if defined(USE_NSS) |
240 net::SetMessageLoopForOCSP(); | 248 net::SetMessageLoopForOCSP(); |
241 #endif // defined(USE_NSS) | 249 #endif // defined(USE_NSS) |
242 | 250 |
243 DCHECK(!globals_); | 251 DCHECK(!globals_); |
244 globals_ = new Globals; | 252 globals_ = new Globals; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 net::HostCache* host_cache = | 404 net::HostCache* host_cache = |
397 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 405 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
398 if (host_cache) | 406 if (host_cache) |
399 host_cache->clear(); | 407 host_cache->clear(); |
400 } | 408 } |
401 // Clear all of the passively logged data. | 409 // Clear all of the passively logged data. |
402 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 410 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
403 // clear the data pertaining to off the record context. | 411 // clear the data pertaining to off the record context. |
404 globals_->net_log->passive_collector()->Clear(); | 412 globals_->net_log->passive_collector()->Clear(); |
405 } | 413 } |
OLD | NEW |