OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/chrome/browser/application_context_impl.h" | 5 #include "ios/chrome/browser/application_context_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ios_chrome_io_thread_.reset( | 98 ios_chrome_io_thread_.reset( |
99 new IOSChromeIOThread(GetLocalState(), GetNetLog())); | 99 new IOSChromeIOThread(GetLocalState(), GetNetLog())); |
100 } | 100 } |
101 | 101 |
102 void ApplicationContextImpl::PreMainMessageLoopRun() { | 102 void ApplicationContextImpl::PreMainMessageLoopRun() { |
103 DCHECK(thread_checker_.CalledOnValidThread()); | 103 DCHECK(thread_checker_.CalledOnValidThread()); |
104 } | 104 } |
105 | 105 |
106 void ApplicationContextImpl::StartTearDown() { | 106 void ApplicationContextImpl::StartTearDown() { |
107 DCHECK(thread_checker_.CalledOnValidThread()); | 107 DCHECK(thread_checker_.CalledOnValidThread()); |
108 // We need to destroy the MetricsServicesManager before the IO thread gets | 108 // We need to destroy the MetricsServicesManager and NetworkTimeTracker before |
109 // destroyed, since the destructor can call the URLFetcher destructor, which | 109 // the IO thread gets destroyed, since the destructor can call the URLFetcher |
110 // does a PostDelayedTask operation on the IO thread. (The IO thread will | 110 // destructor, which does a PostDelayedTask operation on the IO thread. (The |
111 // handle that URLFetcher operation before going away.) | 111 // IO thread will handle that URLFetcher operation before going away.) |
112 | 112 |
113 metrics_services_manager_.reset(); | 113 metrics_services_manager_.reset(); |
| 114 network_time_tracker_.reset(); |
114 | 115 |
115 // Need to clear browser states before the IO thread. | 116 // Need to clear browser states before the IO thread. |
116 chrome_browser_state_manager_.reset(); | 117 chrome_browser_state_manager_.reset(); |
117 | 118 |
118 // The GCMDriver must shut down while the IO thread is still alive. | 119 // The GCMDriver must shut down while the IO thread is still alive. |
119 if (gcm_driver_) | 120 if (gcm_driver_) |
120 gcm_driver_->Shutdown(); | 121 gcm_driver_->Shutdown(); |
121 | 122 |
122 if (local_state_) { | 123 if (local_state_) { |
123 local_state_->CommitPendingWrite(); | 124 local_state_->CommitPendingWrite(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 DCHECK(thread_checker_.CalledOnValidThread()); | 248 DCHECK(thread_checker_.CalledOnValidThread()); |
248 return net_log_.get(); | 249 return net_log_.get(); |
249 } | 250 } |
250 | 251 |
251 network_time::NetworkTimeTracker* | 252 network_time::NetworkTimeTracker* |
252 ApplicationContextImpl::GetNetworkTimeTracker() { | 253 ApplicationContextImpl::GetNetworkTimeTracker() { |
253 DCHECK(thread_checker_.CalledOnValidThread()); | 254 DCHECK(thread_checker_.CalledOnValidThread()); |
254 if (!network_time_tracker_) { | 255 if (!network_time_tracker_) { |
255 network_time_tracker_.reset(new network_time::NetworkTimeTracker( | 256 network_time_tracker_.reset(new network_time::NetworkTimeTracker( |
256 base::WrapUnique(new base::DefaultClock), | 257 base::WrapUnique(new base::DefaultClock), |
257 base::WrapUnique(new base::DefaultTickClock), GetLocalState())); | 258 base::WrapUnique(new base::DefaultTickClock), GetLocalState(), |
| 259 GetSystemURLRequestContext())); |
258 } | 260 } |
259 return network_time_tracker_.get(); | 261 return network_time_tracker_.get(); |
260 } | 262 } |
261 | 263 |
262 IOSChromeIOThread* ApplicationContextImpl::GetIOSChromeIOThread() { | 264 IOSChromeIOThread* ApplicationContextImpl::GetIOSChromeIOThread() { |
263 DCHECK(thread_checker_.CalledOnValidThread()); | 265 DCHECK(thread_checker_.CalledOnValidThread()); |
264 DCHECK(ios_chrome_io_thread_.get()); | 266 DCHECK(ios_chrome_io_thread_.get()); |
265 return ios_chrome_io_thread_.get(); | 267 return ios_chrome_io_thread_.get(); |
266 } | 268 } |
267 | 269 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 worker_pool->GetSequenceToken(), | 350 worker_pool->GetSequenceToken(), |
349 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 351 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
350 | 352 |
351 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 353 gcm_driver_ = gcm::CreateGCMDriverDesktop( |
352 base::WrapUnique(new gcm::GCMClientFactory), GetLocalState(), store_path, | 354 base::WrapUnique(new gcm::GCMClientFactory), GetLocalState(), store_path, |
353 GetSystemURLRequestContext(), ::GetChannel(), | 355 GetSystemURLRequestContext(), ::GetChannel(), |
354 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), | 356 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), |
355 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), | 357 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), |
356 blocking_task_runner); | 358 blocking_task_runner); |
357 } | 359 } |
OLD | NEW |