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 "components/cronet/android/cronet_url_request_context_adapter.h" | 5 #include "components/cronet/android/cronet_url_request_context_adapter.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 delete network_thread; | 739 delete network_thread; |
740 } | 740 } |
741 | 741 |
742 net::URLRequestContext* CronetURLRequestContextAdapter::GetURLRequestContext() { | 742 net::URLRequestContext* CronetURLRequestContextAdapter::GetURLRequestContext() { |
743 if (!context_) { | 743 if (!context_) { |
744 LOG(ERROR) << "URLRequestContext is not set up"; | 744 LOG(ERROR) << "URLRequestContext is not set up"; |
745 } | 745 } |
746 return context_.get(); | 746 return context_.get(); |
747 } | 747 } |
748 | 748 |
| 749 jlong CronetURLRequestContextAdapter::GetUrlRequestContextForTesting( |
| 750 JNIEnv* env, |
| 751 const base::android::JavaParamRef<jobject>& jcaller) { |
| 752 return reinterpret_cast<jlong>(GetURLRequestContext()); |
| 753 } |
| 754 |
749 void CronetURLRequestContextAdapter::PostTaskToNetworkThread( | 755 void CronetURLRequestContextAdapter::PostTaskToNetworkThread( |
750 const tracked_objects::Location& posted_from, | 756 const tracked_objects::Location& posted_from, |
751 const base::Closure& callback) { | 757 const base::Closure& callback) { |
752 GetNetworkTaskRunner()->PostTask( | 758 GetNetworkTaskRunner()->PostTask( |
753 posted_from, base::Bind(&CronetURLRequestContextAdapter:: | 759 posted_from, base::Bind(&CronetURLRequestContextAdapter:: |
754 RunTaskAfterContextInitOnNetworkThread, | 760 RunTaskAfterContextInitOnNetworkThread, |
755 base::Unretained(this), callback)); | 761 base::Unretained(this), callback)); |
756 } | 762 } |
757 | 763 |
758 void CronetURLRequestContextAdapter::RunTaskAfterContextInitOnNetworkThread( | 764 void CronetURLRequestContextAdapter::RunTaskAfterContextInitOnNetworkThread( |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 JNIEnv* env, | 1079 JNIEnv* env, |
1074 const JavaParamRef<jclass>& jcaller) { | 1080 const JavaParamRef<jclass>& jcaller) { |
1075 base::StatisticsRecorder::Initialize(); | 1081 base::StatisticsRecorder::Initialize(); |
1076 std::vector<uint8_t> data; | 1082 std::vector<uint8_t> data; |
1077 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1083 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
1078 return ScopedJavaLocalRef<jbyteArray>(); | 1084 return ScopedJavaLocalRef<jbyteArray>(); |
1079 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1085 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
1080 } | 1086 } |
1081 | 1087 |
1082 } // namespace cronet | 1088 } // namespace cronet |
OLD | NEW |