OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 }; | 82 }; |
83 | 83 |
84 // Used for the "system" URLRequestContext. If this grows more complicated, then | 84 // Used for the "system" URLRequestContext. If this grows more complicated, then |
85 // consider inheriting directly from URLRequestContext rather than using | 85 // consider inheriting directly from URLRequestContext rather than using |
86 // implementation inheritance. | 86 // implementation inheritance. |
87 class SystemURLRequestContext : public URLRequestContextWithUserAgent { | 87 class SystemURLRequestContext : public URLRequestContextWithUserAgent { |
88 public: | 88 public: |
89 SystemURLRequestContext() { | 89 SystemURLRequestContext() { |
90 #if defined(USE_NSS) | 90 #if defined(USE_NSS) |
91 net::SetURLRequestContextForOCSP(this); | 91 net::SetURLRequestContextForNssPkixIO(this); |
92 #endif // defined(USE_NSS) | 92 #endif // defined(USE_NSS) |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 virtual ~SystemURLRequestContext() { | 96 virtual ~SystemURLRequestContext() { |
97 #if defined(USE_NSS) | 97 #if defined(USE_NSS) |
98 net::SetURLRequestContextForOCSP(NULL); | 98 net::SetURLRequestContextForNssPkixIO(NULL); |
99 #endif // defined(USE_NSS) | 99 #endif // defined(USE_NSS) |
100 } | 100 } |
101 }; | 101 }; |
102 | 102 |
103 net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { | 103 net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { |
104 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 104 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
105 | 105 |
106 size_t parallelism = net::HostResolver::kDefaultParallelism; | 106 size_t parallelism = net::HostResolver::kDefaultParallelism; |
107 | 107 |
108 // Use the concurrency override from the command-line, if any. | 108 // Use the concurrency override from the command-line, if any. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 364 } |
365 | 365 |
366 void IOThread::Init() { | 366 void IOThread::Init() { |
367 // Though this thread is called the "IO" thread, it actually just routes | 367 // Though this thread is called the "IO" thread, it actually just routes |
368 // messages around; it shouldn't be allowed to perform any blocking disk I/O. | 368 // messages around; it shouldn't be allowed to perform any blocking disk I/O. |
369 base::ThreadRestrictions::SetIOAllowed(false); | 369 base::ThreadRestrictions::SetIOAllowed(false); |
370 | 370 |
371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
372 | 372 |
373 #if defined(USE_NSS) | 373 #if defined(USE_NSS) |
374 net::SetMessageLoopForOCSP(); | 374 net::SetMessageLoopForNssPkixIO(); |
375 #endif // defined(USE_NSS) | 375 #endif // defined(USE_NSS) |
376 | 376 |
377 DCHECK(!globals_); | 377 DCHECK(!globals_); |
378 globals_ = new Globals; | 378 globals_ = new Globals; |
379 | 379 |
380 globals_->media.media_internals.reset(new MediaInternals()); | 380 globals_->media.media_internals.reset(new MediaInternals()); |
381 | 381 |
382 // Add an observer that will emit network change events to the ChromeNetLog. | 382 // Add an observer that will emit network change events to the ChromeNetLog. |
383 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be | 383 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
384 // logging the network change before other IO thread consumers respond to it. | 384 // logging the network change before other IO thread consumers respond to it. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 weak_factory_.DetachFromThread(); | 463 weak_factory_.DetachFromThread(); |
464 } | 464 } |
465 | 465 |
466 void IOThread::CleanUp() { | 466 void IOThread::CleanUp() { |
467 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); | 467 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
468 | 468 |
469 delete sdch_manager_; | 469 delete sdch_manager_; |
470 sdch_manager_ = NULL; | 470 sdch_manager_ = NULL; |
471 | 471 |
472 #if defined(USE_NSS) | 472 #if defined(USE_NSS) |
473 net::ShutdownOCSP(); | 473 net::ShutdownNssPkixIO(); |
474 #endif // defined(USE_NSS) | 474 #endif // defined(USE_NSS) |
475 | 475 |
476 system_url_request_context_getter_ = NULL; | 476 system_url_request_context_getter_ = NULL; |
477 | 477 |
478 // Release objects that the net::URLRequestContext could have been pointing | 478 // Release objects that the net::URLRequestContext could have been pointing |
479 // to. | 479 // to. |
480 | 480 |
481 // This must be reset before the ChromeNetLog is destroyed. | 481 // This must be reset before the ChromeNetLog is destroyed. |
482 network_change_observer_.reset(); | 482 network_change_observer_.reset(); |
483 | 483 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 new net::HttpNetworkLayer( | 605 new net::HttpNetworkLayer( |
606 new net::HttpNetworkSession(system_params))); | 606 new net::HttpNetworkSession(system_params))); |
607 globals_->system_ftp_transaction_factory.reset( | 607 globals_->system_ftp_transaction_factory.reset( |
608 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 608 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
609 globals_->system_request_context = | 609 globals_->system_request_context = |
610 ConstructSystemRequestContext(globals_, net_log_); | 610 ConstructSystemRequestContext(globals_, net_log_); |
611 | 611 |
612 sdch_manager_->set_sdch_fetcher( | 612 sdch_manager_->set_sdch_fetcher( |
613 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 613 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
614 } | 614 } |
OLD | NEW |