diff options
author | svaldez <svaldez@chromium.org> | 2016-03-18 13:47:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-18 20:50:26 +0000 |
commit | a1714ab3703201b3a3c424fa42788f0e4d060b26 (patch) | |
tree | 913fbf63f036b0dae8494dc500c03ff6bc3aaf82 /ios | |
parent | 1d492be0508e1638a37ac6a156d16e9f724da69c (diff) | |
download | chromium_src-a1714ab3703201b3a3c424fa42788f0e4d060b26.zip chromium_src-a1714ab3703201b3a3c424fa42788f0e4d060b26.tar.gz chromium_src-a1714ab3703201b3a3c424fa42788f0e4d060b26.tar.bz2 |
Adding macro to enable changing SSL library (Part 1)
This changes the macro used to be USE_NSS_VERIFIER and modifies build
files to no longer assume iOS is using NSS.
BUG=591545
Review URL: https://codereview.chromium.org/1808963004
Cr-Commit-Position: refs/heads/master@{#382077}
Diffstat (limited to 'ios')
-rw-r--r-- | ios/chrome/browser/ios_chrome_io_thread.mm | 12 | ||||
-rw-r--r-- | ios/crnet/crnet_environment.mm | 8 | ||||
-rw-r--r-- | ios/web/app/web_main_loop.mm | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/ios/chrome/browser/ios_chrome_io_thread.mm b/ios/chrome/browser/ios_chrome_io_thread.mm index 0fbdab0..4e76c5a 100644 --- a/ios/chrome/browser/ios_chrome_io_thread.mm +++ b/ios/chrome/browser/ios_chrome_io_thread.mm @@ -140,12 +140,18 @@ const char kNpnTrialDisabledGroupNamePrefix[] = "Disable"; // Used for the "system" URLRequestContext. class SystemURLRequestContext : public net::URLRequestContext { public: - SystemURLRequestContext() { net::SetURLRequestContextForNSSHttpIO(this); } + SystemURLRequestContext() { +#if defined(USE_NSS_VERIFIER) + net::SetURLRequestContextForNSSHttpIO(this); +#endif + } private: ~SystemURLRequestContext() override { AssertNoURLRequests(); +#if defined(USE_NSS_VERIFIER) net::SetURLRequestContextForNSSHttpIO(nullptr); +#endif } }; @@ -377,7 +383,9 @@ void IOSChromeIOThread::Init() { TRACE_EVENT0("startup", "IOSChromeIOThread::Init"); DCHECK_CURRENTLY_ON(web::WebThread::IO); +#if defined(USE_NSS_VERIFIER) net::SetMessageLoopForNSSHttpIO(); +#endif const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); @@ -474,7 +482,9 @@ void IOSChromeIOThread::Init() { } void IOSChromeIOThread::CleanUp() { +#if defined(USE_NSS_VERIFIER) net::ShutdownNSSHttpIO(); +#endif system_url_request_context_getter_ = nullptr; diff --git a/ios/crnet/crnet_environment.mm b/ios/crnet/crnet_environment.mm index b5ba3fe..ee2fcee 100644 --- a/ios/crnet/crnet_environment.mm +++ b/ios/crnet/crnet_environment.mm @@ -153,11 +153,15 @@ void CrNetEnvironment::Initialize() { CHECK(base::i18n::InitializeICU()); url::Initialize(); base::CommandLine::Init(0, nullptr); + +#if defined(USE_NSS_VERIFIER) // This needs to happen on the main thread. NSPR's initialization sets up its // memory allocator; if this is not done before other threads are created, // this initialization can race to cause accidental free/allocation // mismatches. crypto::EnsureNSPRInit(); +#endif + // Without doing this, StatisticsRecorder::FactoryGet() leaks one histogram // per call after the first for a given name. base::StatisticsRecorder::Initialize(); @@ -288,7 +292,9 @@ void CrNetEnvironment::Install() { proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( network_io_thread_->task_runner(), nullptr); +#if defined(USE_NSS_VERIFIER) net::SetURLRequestContextForNSSHttpIO(main_context_.get()); +#endif main_context_getter_ = new CrNetURLRequestContextGetter( main_context_.get(), network_io_thread_->task_runner()); base::subtle::MemoryBarrier(); @@ -306,7 +312,9 @@ void CrNetEnvironment::InstallIntoSessionConfiguration( CrNetEnvironment::~CrNetEnvironment() { net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); +#if defined(USE_NSS_VERIFIER) net::SetURLRequestContextForNSSHttpIO(nullptr); +#endif } net::URLRequestContextGetter* CrNetEnvironment::GetMainContextGetter() { diff --git a/ios/web/app/web_main_loop.mm b/ios/web/app/web_main_loop.mm index be504e0..ac91ba6 100644 --- a/ios/web/app/web_main_loop.mm +++ b/ios/web/app/web_main_loop.mm @@ -54,8 +54,10 @@ void WebMainLoop::EarlyInitialization() { parts_->PreEarlyInitialization(); } +#if defined(USE_NSS_VERIFIER) // We want to be sure to init NSPR on the main thread. crypto::EnsureNSPRInit(); +#endif if (parts_) { parts_->PostEarlyInitialization(); |