| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/cronet/ios/cronet_environment.h" | 5 #include "components/cronet/ios/cronet_environment.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return main_context_getter_.get(); | 111 return main_context_getter_.get(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // static | 114 // static |
| 115 void CronetEnvironment::Initialize() { | 115 void CronetEnvironment::Initialize() { |
| 116 // DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); | 116 // DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); |
| 117 // This method must be called once from the main thread. | 117 // This method must be called once from the main thread. |
| 118 if (!g_at_exit_) | 118 if (!g_at_exit_) |
| 119 g_at_exit_ = new base::AtExitManager; | 119 g_at_exit_ = new base::AtExitManager; |
| 120 | 120 |
| 121 base::TaskScheduler::CreateAndSetSimpleTaskScheduler("CronetIos"); | 121 base::TaskScheduler::CreateAndStartWithDefaultParams("CronetIos"); |
| 122 | 122 |
| 123 url::Initialize(); | 123 url::Initialize(); |
| 124 base::CommandLine::Init(0, nullptr); | 124 base::CommandLine::Init(0, nullptr); |
| 125 | 125 |
| 126 // Without doing this, StatisticsRecorder::FactoryGet() leaks one histogram | 126 // Without doing this, StatisticsRecorder::FactoryGet() leaks one histogram |
| 127 // per call after the first for a given name. | 127 // per call after the first for a given name. |
| 128 base::StatisticsRecorder::Initialize(); | 128 base::StatisticsRecorder::Initialize(); |
| 129 | 129 |
| 130 // Create a message loop on the UI thread. | 130 // Create a message loop on the UI thread. |
| 131 DCHECK(!base::MessageLoop::current()); | 131 DCHECK(!base::MessageLoop::current()); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 event->Signal(); | 371 event->Signal(); |
| 372 } | 372 } |
| 373 | 373 |
| 374 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { | 374 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { |
| 375 return base::SysNSStringToUTF8([[NSBundle mainBundle] | 375 return base::SysNSStringToUTF8([[NSBundle mainBundle] |
| 376 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + | 376 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + |
| 377 " Cronet/" + CRONET_VERSION; | 377 " Cronet/" + CRONET_VERSION; |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace cronet | 380 } // namespace cronet |
| OLD | NEW |