| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 cronet::CronetEnvironment* environment_; | 90 cronet::CronetEnvironment* environment_; |
| 91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 92 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextGetter); | 92 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextGetter); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace | 95 } // namespace |
| 96 | 96 |
| 97 namespace cronet { | 97 namespace cronet { |
| 98 | 98 |
| 99 bool CronetEnvironment::IsOnNetworkThread() { | |
| 100 return network_io_thread_->task_runner()->BelongsToCurrentThread(); | |
| 101 } | |
| 102 | |
| 103 void CronetEnvironment::PostToNetworkThread( | 99 void CronetEnvironment::PostToNetworkThread( |
| 104 const tracked_objects::Location& from_here, | 100 const tracked_objects::Location& from_here, |
| 105 const base::Closure& task) { | 101 const base::Closure& task) { |
| 106 network_io_thread_->task_runner()->PostTask(from_here, task); | 102 network_io_thread_->task_runner()->PostTask(from_here, task); |
| 107 } | 103 } |
| 108 | 104 |
| 109 void CronetEnvironment::PostToFileUserBlockingThread( | 105 void CronetEnvironment::PostToFileUserBlockingThread( |
| 110 const tracked_objects::Location& from_here, | 106 const tracked_objects::Location& from_here, |
| 111 const base::Closure& task) { | 107 const base::Closure& task) { |
| 112 file_user_blocking_thread_->task_runner()->PostTask(from_here, task); | 108 file_user_blocking_thread_->task_runner()->PostTask(from_here, task); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 390 |
| 395 std::vector<uint8_t> CronetEnvironment::GetHistogramDeltas() { | 391 std::vector<uint8_t> CronetEnvironment::GetHistogramDeltas() { |
| 396 base::StatisticsRecorder::Initialize(); | 392 base::StatisticsRecorder::Initialize(); |
| 397 std::vector<uint8_t> data; | 393 std::vector<uint8_t> data; |
| 398 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 394 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 399 return std::vector<uint8_t>(); | 395 return std::vector<uint8_t>(); |
| 400 return data; | 396 return data; |
| 401 } | 397 } |
| 402 | 398 |
| 403 } // namespace cronet | 399 } // namespace cronet |
| OLD | NEW |