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

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

Issue 11434009: Ensure that NSS HTTP IO is initialized on iOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync with ToT Created 8 years 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 | « no previous file | net/socket/ssl_server_socket_nss.cc » ('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) 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/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "net/proxy/proxy_service.h" 60 #include "net/proxy/proxy_service.h"
61 #include "net/spdy/spdy_session.h" 61 #include "net/spdy/spdy_session.h"
62 #include "net/url_request/url_fetcher.h" 62 #include "net/url_request/url_fetcher.h"
63 #include "net/url_request/url_request_throttler_manager.h" 63 #include "net/url_request/url_request_throttler_manager.h"
64 #include "net/websockets/websocket_job.h" 64 #include "net/websockets/websocket_job.h"
65 65
66 #if defined(ENABLE_CONFIGURATION_POLICY) 66 #if defined(ENABLE_CONFIGURATION_POLICY)
67 #include "policy/policy_constants.h" 67 #include "policy/policy_constants.h"
68 #endif 68 #endif
69 69
70 #if defined(USE_NSS) 70 #if defined(USE_NSS) || defined(OS_IOS)
Nico 2012/12/01 01:41:21 Is NSS used on IOS? If so, should USE_NSS be set w
wtc 2012/12/01 02:19:43 NSS is used on iOS to verify certificates. The tes
71 #include "net/ocsp/nss_ocsp.h" 71 #include "net/ocsp/nss_ocsp.h"
72 #endif // defined(USE_NSS) 72 #endif
73 73
74 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
75 #include "chrome/browser/chromeos/proxy_config_service_impl.h" 75 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
76 #endif // defined(OS_CHROMEOS) 76 #endif // defined(OS_CHROMEOS)
77 77
78 using content::BrowserThread; 78 using content::BrowserThread;
79 79
80 class SafeBrowsingURLRequestContext; 80 class SafeBrowsingURLRequestContext;
81 81
82 // The IOThread object must outlive any tasks posted to the IO thread before the 82 // The IOThread object must outlive any tasks posted to the IO thread before the
83 // Quit task, so base::Bind() calls are not refcounted. 83 // Quit task, so base::Bind() calls are not refcounted.
84 84
85 namespace { 85 namespace {
86 86
87 #if defined(OS_MACOSX) && !defined(OS_IOS) 87 #if defined(OS_MACOSX) && !defined(OS_IOS)
88 void ObserveKeychainEvents() { 88 void ObserveKeychainEvents() {
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
90 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); 90 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents();
91 } 91 }
92 #endif 92 #endif
93 93
94 // Used for the "system" URLRequestContext. 94 // Used for the "system" URLRequestContext.
95 class SystemURLRequestContext : public net::URLRequestContext { 95 class SystemURLRequestContext : public net::URLRequestContext {
96 public: 96 public:
97 SystemURLRequestContext() { 97 SystemURLRequestContext() {
98 #if defined(USE_NSS) 98 #if defined(USE_NSS) || defined(OS_IOS)
99 net::SetURLRequestContextForNSSHttpIO(this); 99 net::SetURLRequestContextForNSSHttpIO(this);
100 #endif // defined(USE_NSS) 100 #endif
101 } 101 }
102 102
103 private: 103 private:
104 virtual ~SystemURLRequestContext() { 104 virtual ~SystemURLRequestContext() {
105 #if defined(USE_NSS) 105 #if defined(USE_NSS) || defined(OS_IOS)
106 net::SetURLRequestContextForNSSHttpIO(NULL); 106 net::SetURLRequestContextForNSSHttpIO(NULL);
107 #endif // defined(USE_NSS) 107 #endif
108 } 108 }
109 }; 109 };
110 110
111 scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) { 111 scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) {
112 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 112 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
113 113
114 net::HostResolver::Options options; 114 net::HostResolver::Options options;
115 115
116 // Use the concurrency override from the command-line, if any. 116 // Use the concurrency override from the command-line, if any.
117 if (command_line.HasSwitch(switches::kHostResolverParallelism)) { 117 if (command_line.HasSwitch(switches::kHostResolverParallelism)) {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 429 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
430 if (!system_url_request_context_getter_) { 430 if (!system_url_request_context_getter_) {
431 InitSystemRequestContext(); 431 InitSystemRequestContext();
432 } 432 }
433 return system_url_request_context_getter_; 433 return system_url_request_context_getter_;
434 } 434 }
435 435
436 void IOThread::Init() { 436 void IOThread::Init() {
437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
438 438
439 #if defined(USE_NSS) 439 #if defined(USE_NSS) || defined(OS_IOS)
440 net::SetMessageLoopForNSSHttpIO(); 440 net::SetMessageLoopForNSSHttpIO();
441 #endif // defined(USE_NSS) 441 #endif
442 442
443 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 443 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
444 444
445 DCHECK(!globals_); 445 DCHECK(!globals_);
446 globals_ = new Globals; 446 globals_ = new Globals;
447 447
448 // Add an observer that will emit network change events to the ChromeNetLog. 448 // Add an observer that will emit network change events to the ChromeNetLog.
449 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be 449 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be
450 // logging the network change before other IO thread consumers respond to it. 450 // logging the network change before other IO thread consumers respond to it.
451 network_change_observer_.reset( 451 network_change_observer_.reset(
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // error. 567 // error.
568 weak_factory_.DetachFromThread(); 568 weak_factory_.DetachFromThread();
569 } 569 }
570 570
571 void IOThread::CleanUp() { 571 void IOThread::CleanUp() {
572 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); 572 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks();
573 573
574 delete sdch_manager_; 574 delete sdch_manager_;
575 sdch_manager_ = NULL; 575 sdch_manager_ = NULL;
576 576
577 #if defined(USE_NSS) 577 #if defined(USE_NSS) || defined(OS_IOS)
578 net::ShutdownNSSHttpIO(); 578 net::ShutdownNSSHttpIO();
579 #endif // defined(USE_NSS) 579 #endif
580 580
581 system_url_request_context_getter_ = NULL; 581 system_url_request_context_getter_ = NULL;
582 582
583 // Release objects that the net::URLRequestContext could have been pointing 583 // Release objects that the net::URLRequestContext could have been pointing
584 // to. 584 // to.
585 585
586 // This must be reset before the ChromeNetLog is destroyed. 586 // This must be reset before the ChromeNetLog is destroyed.
587 network_change_observer_.reset(); 587 network_change_observer_.reset();
588 588
589 system_proxy_config_service_.reset(); 589 system_proxy_config_service_.reset();
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 globals_->system_request_context.reset( 844 globals_->system_request_context.reset(
845 ConstructSystemRequestContext(globals_, net_log_)); 845 ConstructSystemRequestContext(globals_, net_log_));
846 846
847 sdch_manager_->set_sdch_fetcher( 847 sdch_manager_->set_sdch_fetcher(
848 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); 848 new SdchDictionaryFetcher(system_url_request_context_getter_.get()));
849 } 849 }
850 850
851 void IOThread::UpdateDnsClientEnabled() { 851 void IOThread::UpdateDnsClientEnabled() {
852 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); 852 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_);
853 } 853 }
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_server_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698