| 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 <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(), source); | 680 (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(), source); |
| 681 } | 681 } |
| 682 | 682 |
| 683 // Create a URLRequestContextConfig from the given parameters. | 683 // Create a URLRequestContextConfig from the given parameters. |
| 684 static jlong CreateRequestContextConfig( | 684 static jlong CreateRequestContextConfig( |
| 685 JNIEnv* env, | 685 JNIEnv* env, |
| 686 const JavaParamRef<jclass>& jcaller, | 686 const JavaParamRef<jclass>& jcaller, |
| 687 const JavaParamRef<jstring>& juser_agent, | 687 const JavaParamRef<jstring>& juser_agent, |
| 688 const JavaParamRef<jstring>& jstorage_path, | 688 const JavaParamRef<jstring>& jstorage_path, |
| 689 jboolean jquic_enabled, | 689 jboolean jquic_enabled, |
| 690 const JavaParamRef<jstring>& jquic_default_user_agent_id, |
| 690 jboolean jhttp2_enabled, | 691 jboolean jhttp2_enabled, |
| 691 jboolean jsdch_enabled, | 692 jboolean jsdch_enabled, |
| 692 const JavaParamRef<jstring>& jdata_reduction_proxy_key, | 693 const JavaParamRef<jstring>& jdata_reduction_proxy_key, |
| 693 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy, | 694 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy, |
| 694 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy, | 695 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy, |
| 695 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url, | 696 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url, |
| 696 jboolean jdisable_cache, | 697 jboolean jdisable_cache, |
| 697 jint jhttp_cache_mode, | 698 jint jhttp_cache_mode, |
| 698 jlong jhttp_cache_max_size, | 699 jlong jhttp_cache_max_size, |
| 699 const JavaParamRef<jstring>& jexperimental_quic_connection_options, | 700 const JavaParamRef<jstring>& jexperimental_quic_connection_options, |
| 700 jlong jmock_cert_verifier) { | 701 jlong jmock_cert_verifier) { |
| 701 return reinterpret_cast<jlong>(new URLRequestContextConfig( | 702 return reinterpret_cast<jlong>(new URLRequestContextConfig( |
| 702 jquic_enabled, jhttp2_enabled, jsdch_enabled, | 703 jquic_enabled, |
| 704 base::android::ConvertJavaStringToUTF8(env, jquic_default_user_agent_id), |
| 705 jhttp2_enabled, jsdch_enabled, |
| 703 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode), | 706 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode), |
| 704 jhttp_cache_max_size, jdisable_cache, | 707 jhttp_cache_max_size, jdisable_cache, |
| 705 base::android::ConvertJavaStringToUTF8(env, jstorage_path), | 708 base::android::ConvertJavaStringToUTF8(env, jstorage_path), |
| 706 base::android::ConvertJavaStringToUTF8(env, juser_agent), | 709 base::android::ConvertJavaStringToUTF8(env, juser_agent), |
| 707 base::android::ConvertJavaStringToUTF8( | 710 base::android::ConvertJavaStringToUTF8( |
| 708 env, jexperimental_quic_connection_options), | 711 env, jexperimental_quic_connection_options), |
| 709 base::android::ConvertJavaStringToUTF8(env, jdata_reduction_proxy_key), | 712 base::android::ConvertJavaStringToUTF8(env, jdata_reduction_proxy_key), |
| 710 base::android::ConvertJavaStringToUTF8( | 713 base::android::ConvertJavaStringToUTF8( |
| 711 env, jdata_reduction_proxy_primary_proxy), | 714 env, jdata_reduction_proxy_primary_proxy), |
| 712 base::android::ConvertJavaStringToUTF8( | 715 base::android::ConvertJavaStringToUTF8( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 JNIEnv* env, | 801 JNIEnv* env, |
| 799 const JavaParamRef<jclass>& jcaller) { | 802 const JavaParamRef<jclass>& jcaller) { |
| 800 base::StatisticsRecorder::Initialize(); | 803 base::StatisticsRecorder::Initialize(); |
| 801 std::vector<uint8_t> data; | 804 std::vector<uint8_t> data; |
| 802 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 805 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 803 return ScopedJavaLocalRef<jbyteArray>(); | 806 return ScopedJavaLocalRef<jbyteArray>(); |
| 804 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 807 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 805 } | 808 } |
| 806 | 809 |
| 807 } // namespace cronet | 810 } // namespace cronet |
| OLD | NEW |