Chromium Code Reviews| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 #include "net/base/net_errors.h" | 51 #include "net/base/net_errors.h" |
| 52 #include "net/base/network_delegate_impl.h" | 52 #include "net/base/network_delegate_impl.h" |
| 53 #include "net/base/url_util.h" | 53 #include "net/base/url_util.h" |
| 54 #include "net/cert/caching_cert_verifier.h" | 54 #include "net/cert/caching_cert_verifier.h" |
| 55 #include "net/cert/cert_verifier.h" | 55 #include "net/cert/cert_verifier.h" |
| 56 #include "net/cookies/cookie_monster.h" | 56 #include "net/cookies/cookie_monster.h" |
| 57 #include "net/http/http_auth_handler_factory.h" | 57 #include "net/http/http_auth_handler_factory.h" |
| 58 #include "net/http/http_server_properties_manager.h" | 58 #include "net/http/http_server_properties_manager.h" |
| 59 #include "net/log/file_net_log_observer.h" | 59 #include "net/log/file_net_log_observer.h" |
| 60 #include "net/log/net_log_util.h" | 60 #include "net/log/net_log_util.h" |
| 61 #include "net/log/write_to_file_net_log_observer.h" | |
| 62 #include "net/nqe/external_estimate_provider.h" | 61 #include "net/nqe/external_estimate_provider.h" |
| 63 #include "net/nqe/network_qualities_prefs_manager.h" | 62 #include "net/nqe/network_qualities_prefs_manager.h" |
| 64 #include "net/proxy/proxy_config_service_android.h" | 63 #include "net/proxy/proxy_config_service_android.h" |
| 65 #include "net/proxy/proxy_service.h" | 64 #include "net/proxy/proxy_service.h" |
| 66 #include "net/sdch/sdch_owner.h" | 65 #include "net/sdch/sdch_owner.h" |
| 67 #include "net/ssl/channel_id_service.h" | 66 #include "net/ssl/channel_id_service.h" |
| 68 #include "net/url_request/url_request_context.h" | 67 #include "net/url_request/url_request_context.h" |
| 69 #include "net/url_request/url_request_context_builder.h" | 68 #include "net/url_request/url_request_context_builder.h" |
| 70 #include "net/url_request/url_request_interceptor.h" | 69 #include "net/url_request/url_request_interceptor.h" |
| 71 | 70 |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 if (pref_service_) | 498 if (pref_service_) |
| 500 pref_service_->CommitPendingWrite(); | 499 pref_service_->CommitPendingWrite(); |
| 501 if (network_quality_estimator_) { | 500 if (network_quality_estimator_) { |
| 502 network_quality_estimator_->RemoveRTTObserver(this); | 501 network_quality_estimator_->RemoveRTTObserver(this); |
| 503 network_quality_estimator_->RemoveThroughputObserver(this); | 502 network_quality_estimator_->RemoveThroughputObserver(this); |
| 504 network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this); | 503 network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this); |
| 505 network_quality_estimator_->RemoveRTTAndThroughputEstimatesObserver(this); | 504 network_quality_estimator_->RemoveRTTAndThroughputEstimatesObserver(this); |
| 506 } | 505 } |
| 507 | 506 |
| 508 // Stop NetLog observer if there is one. | 507 // Stop NetLog observer if there is one. |
| 509 StopNetLogHelper(); | 508 StopNetLogOnNetworkThread(); |
| 510 } | 509 } |
| 511 | 510 |
| 512 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( | 511 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( |
| 513 JNIEnv* env, | 512 JNIEnv* env, |
| 514 const JavaParamRef<jobject>& jcaller) { | 513 const JavaParamRef<jobject>& jcaller) { |
| 515 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref; | 514 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref; |
| 516 jcaller_ref.Reset(env, jcaller); | 515 jcaller_ref.Reset(env, jcaller); |
| 517 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( | 516 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
| 518 GetNetworkTaskRunner(), nullptr /* Ignored on Android */); | 517 GetNetworkTaskRunner(), nullptr /* Ignored on Android */); |
| 519 net::ProxyConfigServiceAndroid* android_proxy_config_service = | 518 net::ProxyConfigServiceAndroid* android_proxy_config_service = |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 base::Unretained(this), should)); | 602 base::Unretained(this), should)); |
| 604 } | 603 } |
| 605 | 604 |
| 606 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( | 605 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( |
| 607 std::unique_ptr<URLRequestContextConfig> config, | 606 std::unique_ptr<URLRequestContextConfig> config, |
| 608 const base::android::ScopedJavaGlobalRef<jobject>& | 607 const base::android::ScopedJavaGlobalRef<jobject>& |
| 609 jcronet_url_request_context) { | 608 jcronet_url_request_context) { |
| 610 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 609 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 611 DCHECK(!is_context_initialized_); | 610 DCHECK(!is_context_initialized_); |
| 612 DCHECK(proxy_config_service_); | 611 DCHECK(proxy_config_service_); |
| 612 | |
| 613 // TODO(mmenke): Add method to have the builder enable SPDY. | 613 // TODO(mmenke): Add method to have the builder enable SPDY. |
| 614 net::URLRequestContextBuilder context_builder; | 614 net::URLRequestContextBuilder context_builder; |
| 615 | 615 |
| 616 std::unique_ptr<net::NetworkDelegate> network_delegate( | 616 std::unique_ptr<net::NetworkDelegate> network_delegate( |
| 617 new BasicNetworkDelegate()); | 617 new BasicNetworkDelegate()); |
| 618 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 618 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 619 DCHECK(!data_reduction_proxy_); | 619 DCHECK(!data_reduction_proxy_); |
| 620 // For now, the choice to enable the data reduction proxy happens once, | 620 // For now, the choice to enable the data reduction proxy happens once, |
| 621 // at initialization. It cannot be disabled thereafter. | 621 // at initialization. It cannot be disabled thereafter. |
| 622 if (!config->data_reduction_proxy_key.empty()) { | 622 if (!config->data_reduction_proxy_key.empty()) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 641 // URL is present. Create a proxy service without a resolver and rely on this | 641 // URL is present. Create a proxy service without a resolver and rely on this |
| 642 // local HTTP proxy. See: crbug.com/432539. | 642 // local HTTP proxy. See: crbug.com/432539. |
| 643 context_builder.set_proxy_service( | 643 context_builder.set_proxy_service( |
| 644 net::ProxyService::CreateWithoutProxyResolver( | 644 net::ProxyService::CreateWithoutProxyResolver( |
| 645 std::move(proxy_config_service_), g_net_log.Get().net_log())); | 645 std::move(proxy_config_service_), g_net_log.Get().net_log())); |
| 646 | 646 |
| 647 config->ConfigureURLRequestContextBuilder(&context_builder, | 647 config->ConfigureURLRequestContextBuilder(&context_builder, |
| 648 g_net_log.Get().net_log(), | 648 g_net_log.Get().net_log(), |
| 649 GetFileThread()->task_runner()); | 649 GetFileThread()->task_runner()); |
| 650 | 650 |
| 651 effective_experimental_options_ = | |
| 652 std::move(config->effective_experimental_options); | |
| 653 | |
| 651 // Set up pref file if storage path is specified. | 654 // Set up pref file if storage path is specified. |
| 652 if (!config->storage_path.empty()) { | 655 if (!config->storage_path.empty()) { |
| 653 base::FilePath storage_path(config->storage_path); | 656 base::FilePath storage_path(config->storage_path); |
| 654 // Make sure storage directory has correct version. | 657 // Make sure storage directory has correct version. |
| 655 InitializeStorageDirectory(storage_path); | 658 InitializeStorageDirectory(storage_path); |
| 656 base::FilePath filepath = | 659 base::FilePath filepath = |
| 657 storage_path.Append(FILE_PATH_LITERAL(kPrefsDirectoryName)) | 660 storage_path.Append(FILE_PATH_LITERAL(kPrefsDirectoryName)) |
| 658 .Append(FILE_PATH_LITERAL(kPrefsFileName)); | 661 .Append(FILE_PATH_LITERAL(kPrefsFileName)); |
| 659 json_pref_store_ = | 662 json_pref_store_ = |
| 660 new JsonPrefStore(filepath, GetFileThread()->task_runner(), | 663 new JsonPrefStore(filepath, GetFileThread()->task_runner(), |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 | 870 |
| 868 bool CronetURLRequestContextAdapter::IsOnNetworkThread() const { | 871 bool CronetURLRequestContextAdapter::IsOnNetworkThread() const { |
| 869 return GetNetworkTaskRunner()->BelongsToCurrentThread(); | 872 return GetNetworkTaskRunner()->BelongsToCurrentThread(); |
| 870 } | 873 } |
| 871 | 874 |
| 872 scoped_refptr<base::SingleThreadTaskRunner> | 875 scoped_refptr<base::SingleThreadTaskRunner> |
| 873 CronetURLRequestContextAdapter::GetNetworkTaskRunner() const { | 876 CronetURLRequestContextAdapter::GetNetworkTaskRunner() const { |
| 874 return network_thread_->task_runner(); | 877 return network_thread_->task_runner(); |
| 875 } | 878 } |
| 876 | 879 |
| 877 bool CronetURLRequestContextAdapter::StartNetLogToFile( | 880 void CronetURLRequestContextAdapter::StartNetLogToFile( |
| 878 JNIEnv* env, | 881 JNIEnv* env, |
| 879 const JavaParamRef<jobject>& jcaller, | 882 const JavaParamRef<jobject>& jcaller, |
| 880 const JavaParamRef<jstring>& jfile_name, | 883 const JavaParamRef<jstring>& jfile_name, |
| 881 jboolean jlog_all) { | 884 jboolean jlog_all) { |
| 882 base::AutoLock lock(write_to_file_observer_lock_); | 885 PostTaskToNetworkThread( |
| 883 // Do nothing if already logging to a file. | 886 FROM_HERE, |
| 884 if (write_to_file_observer_) | 887 base::Bind(&CronetURLRequestContextAdapter::StartNetLogOnNetworkThread, |
| 885 return true; | 888 base::Unretained(this), |
| 886 std::string file_name = | 889 base::android::ConvertJavaStringToUTF8(env, jfile_name), |
| 887 base::android::ConvertJavaStringToUTF8(env, jfile_name); | 890 jlog_all == JNI_TRUE)); |
| 888 base::FilePath file_path(file_name); | |
| 889 base::ScopedFILE file(base::OpenFile(file_path, "w")); | |
| 890 if (!file) { | |
| 891 LOG(ERROR) << "Failed to open NetLog file for writing."; | |
| 892 return false; | |
| 893 } | |
| 894 | |
| 895 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); | |
| 896 if (jlog_all == JNI_TRUE) { | |
| 897 write_to_file_observer_->set_capture_mode( | |
| 898 net::NetLogCaptureMode::IncludeSocketBytes()); | |
| 899 } | |
| 900 write_to_file_observer_->StartObserving( | |
| 901 g_net_log.Get().net_log(), std::move(file), | |
| 902 /*constants=*/nullptr, /*url_request_context=*/nullptr); | |
| 903 | |
| 904 return true; | |
| 905 } | 891 } |
| 906 | 892 |
| 907 void CronetURLRequestContextAdapter::StartNetLogToDisk( | 893 void CronetURLRequestContextAdapter::StartNetLogToDisk( |
| 908 JNIEnv* env, | 894 JNIEnv* env, |
| 909 const JavaParamRef<jobject>& jcaller, | 895 const JavaParamRef<jobject>& jcaller, |
| 910 const JavaParamRef<jstring>& jdir_name, | 896 const JavaParamRef<jstring>& jdir_name, |
| 911 jboolean jlog_all, | 897 jboolean jlog_all, |
| 912 jint jmax_size) { | 898 jint jmax_size) { |
| 913 PostTaskToNetworkThread( | 899 PostTaskToNetworkThread( |
| 914 FROM_HERE, | 900 FROM_HERE, |
| 915 base::Bind(&CronetURLRequestContextAdapter:: | 901 base::Bind(&CronetURLRequestContextAdapter:: |
| 916 StartNetLogToBoundedFileOnNetworkThread, | 902 StartNetLogToBoundedFileOnNetworkThread, |
| 917 base::Unretained(this), | 903 base::Unretained(this), |
| 918 base::android::ConvertJavaStringToUTF8(env, jdir_name), | 904 base::android::ConvertJavaStringToUTF8(env, jdir_name), |
| 919 jlog_all, jmax_size)); | 905 jlog_all, jmax_size)); |
| 920 } | 906 } |
| 921 | 907 |
| 922 void CronetURLRequestContextAdapter::StopNetLog( | 908 void CronetURLRequestContextAdapter::StopNetLog( |
| 923 JNIEnv* env, | 909 JNIEnv* env, |
| 924 const JavaParamRef<jobject>& jcaller) { | 910 const JavaParamRef<jobject>& jcaller) { |
| 925 StopNetLogHelper(); | 911 DCHECK(!GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 912 PostTaskToNetworkThread( | |
| 913 FROM_HERE, | |
| 914 base::Bind(&CronetURLRequestContextAdapter::StopNetLogOnNetworkThread, | |
| 915 base::Unretained(this))); | |
| 926 } | 916 } |
| 927 | 917 |
| 928 void CronetURLRequestContextAdapter::GetCertVerifierData( | 918 void CronetURLRequestContextAdapter::GetCertVerifierData( |
| 929 JNIEnv* env, | 919 JNIEnv* env, |
| 930 const JavaParamRef<jobject>& jcaller) { | 920 const JavaParamRef<jobject>& jcaller) { |
| 931 PostTaskToNetworkThread( | 921 PostTaskToNetworkThread( |
| 932 FROM_HERE, | 922 FROM_HERE, |
| 933 base::Bind( | 923 base::Bind( |
| 934 &CronetURLRequestContextAdapter::GetCertVerifierDataOnNetworkThread, | 924 &CronetURLRequestContextAdapter::GetCertVerifierDataOnNetworkThread, |
| 935 base::Unretained(this))); | 925 base::Unretained(this))); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1002 void CronetURLRequestContextAdapter::OnThroughputObservation( | 992 void CronetURLRequestContextAdapter::OnThroughputObservation( |
| 1003 int32_t throughput_kbps, | 993 int32_t throughput_kbps, |
| 1004 const base::TimeTicks& timestamp, | 994 const base::TimeTicks& timestamp, |
| 1005 net::NetworkQualityObservationSource source) { | 995 net::NetworkQualityObservationSource source) { |
| 1006 Java_CronetUrlRequestContext_onThroughputObservation( | 996 Java_CronetUrlRequestContext_onThroughputObservation( |
| 1007 base::android::AttachCurrentThread(), jcronet_url_request_context_, | 997 base::android::AttachCurrentThread(), jcronet_url_request_context_, |
| 1008 throughput_kbps, | 998 throughput_kbps, |
| 1009 (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(), source); | 999 (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(), source); |
| 1010 } | 1000 } |
| 1011 | 1001 |
| 1002 void CronetURLRequestContextAdapter::StartNetLogOnNetworkThread( | |
| 1003 const std::string& file_name, | |
| 1004 bool include_socket_bytes) { | |
| 1005 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | |
| 1006 | |
| 1007 // Do nothing if already logging to a file. | |
| 1008 if (net_log_file_observer_) | |
| 1009 return; | |
| 1010 base::FilePath file_path(file_name); | |
| 1011 base::ScopedFILE file(base::OpenFile(file_path, "w")); | |
|
kapishnikov
2017/03/14 14:37:09
The same file can be opened for writing twice befo
xunjieli
2017/03/14 19:03:06
Yes, it's okay. But on second thought, let's move
| |
| 1012 if (!file) { | |
| 1013 LOG(ERROR) << "Failed to open NetLog file for writing."; | |
| 1014 return; | |
| 1015 } | |
| 1016 | |
| 1017 net_log_file_observer_ = net::FileNetLogObserver::CreateUnbounded( | |
| 1018 GetFileThread()->task_runner(), file_path, /*constants=*/nullptr); | |
| 1019 CreateNetLogEntriesForActiveObjects({context_.get()}, | |
| 1020 net_log_file_observer_.get()); | |
| 1021 net::NetLogCaptureMode capture_mode = | |
| 1022 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() | |
| 1023 : net::NetLogCaptureMode::Default(); | |
| 1024 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(), | |
| 1025 capture_mode); | |
| 1026 } | |
| 1027 | |
| 1012 void CronetURLRequestContextAdapter::StartNetLogToBoundedFileOnNetworkThread( | 1028 void CronetURLRequestContextAdapter::StartNetLogToBoundedFileOnNetworkThread( |
| 1013 const std::string& dir_path, | 1029 const std::string& dir_path, |
| 1014 bool include_socket_bytes, | 1030 bool include_socket_bytes, |
| 1015 int size) { | 1031 int size) { |
| 1016 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 1032 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 1017 | 1033 |
| 1018 // Do nothing if already logging to a directory. | 1034 // Do nothing if already logging to a directory. |
| 1019 if (bounded_file_observer_) | 1035 if (net_log_file_observer_) |
| 1020 return; | 1036 return; |
| 1021 | 1037 |
| 1022 // Filepath for NetLog files must exist and be writable. | 1038 // Filepath for NetLog files must exist and be writable. |
| 1023 base::FilePath file_path(dir_path); | 1039 base::FilePath file_path(dir_path); |
| 1024 DCHECK(base::PathIsWritable(file_path)); | 1040 DCHECK(base::PathIsWritable(file_path)); |
| 1025 | 1041 |
| 1026 bounded_file_observer_ = net::FileNetLogObserver::CreateBounded( | 1042 net_log_file_observer_ = net::FileNetLogObserver::CreateBounded( |
| 1027 GetFileThread()->task_runner(), file_path, size, kNumNetLogEventFiles, | 1043 GetFileThread()->task_runner(), file_path, size, kNumNetLogEventFiles, |
| 1028 /*constants=*/nullptr); | 1044 /*constants=*/nullptr); |
| 1029 | 1045 |
| 1030 CreateNetLogEntriesForActiveObjects({context_.get()}, | 1046 CreateNetLogEntriesForActiveObjects({context_.get()}, |
| 1031 bounded_file_observer_.get()); | 1047 net_log_file_observer_.get()); |
| 1032 | 1048 |
| 1033 net::NetLogCaptureMode capture_mode = | 1049 net::NetLogCaptureMode capture_mode = |
| 1034 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() | 1050 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() |
| 1035 : net::NetLogCaptureMode::Default(); | 1051 : net::NetLogCaptureMode::Default(); |
| 1036 bounded_file_observer_->StartObserving(g_net_log.Get().net_log(), | 1052 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(), |
| 1037 capture_mode); | 1053 capture_mode); |
| 1038 } | 1054 } |
| 1039 | 1055 |
| 1040 void CronetURLRequestContextAdapter::StopBoundedFileNetLogOnNetworkThread() { | 1056 void CronetURLRequestContextAdapter::StopNetLogOnNetworkThread() { |
| 1041 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 1057 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 1042 bounded_file_observer_->StopObserving( | 1058 |
| 1043 net::GetNetInfo(context_.get(), net::NET_INFO_ALL_SOURCES), | 1059 if (!net_log_file_observer_) |
| 1060 return; | |
| 1061 net_log_file_observer_->StopObserving( | |
| 1062 GetNetLogInfo(), | |
| 1044 base::Bind(&CronetURLRequestContextAdapter::StopNetLogCompleted, | 1063 base::Bind(&CronetURLRequestContextAdapter::StopNetLogCompleted, |
| 1045 base::Unretained(this))); | 1064 base::Unretained(this))); |
| 1046 bounded_file_observer_.reset(); | 1065 net_log_file_observer_.reset(); |
| 1047 } | 1066 } |
| 1048 | 1067 |
| 1049 void CronetURLRequestContextAdapter::StopNetLogCompleted() { | 1068 void CronetURLRequestContextAdapter::StopNetLogCompleted() { |
| 1050 Java_CronetUrlRequestContext_stopNetLogCompleted( | 1069 Java_CronetUrlRequestContext_stopNetLogCompleted( |
| 1051 base::android::AttachCurrentThread(), jcronet_url_request_context_.obj()); | 1070 base::android::AttachCurrentThread(), jcronet_url_request_context_.obj()); |
| 1052 } | 1071 } |
| 1053 | 1072 |
| 1054 void CronetURLRequestContextAdapter::StopNetLogHelper() { | 1073 std::unique_ptr<base::DictionaryValue> |
| 1055 base::AutoLock lock(write_to_file_observer_lock_); | 1074 CronetURLRequestContextAdapter::GetNetLogInfo() const { |
| 1056 DCHECK(!(write_to_file_observer_ && bounded_file_observer_)); | 1075 std::unique_ptr<base::DictionaryValue> net_info = |
| 1057 if (write_to_file_observer_) { | 1076 net::GetNetInfo(context_.get(), net::NET_INFO_ALL_SOURCES); |
| 1058 write_to_file_observer_->StopObserving(/*url_request_context=*/nullptr); | 1077 if (effective_experimental_options_) { |
| 1059 write_to_file_observer_.reset(); | 1078 net_info->Set("cronetExperimentalParams", |
| 1060 } else if (bounded_file_observer_) { | 1079 effective_experimental_options_->CreateDeepCopy()); |
| 1061 PostTaskToNetworkThread(FROM_HERE, | |
| 1062 base::Bind(&CronetURLRequestContextAdapter:: | |
| 1063 StopBoundedFileNetLogOnNetworkThread, | |
| 1064 base::Unretained(this))); | |
| 1065 } | 1080 } |
| 1081 return net_info; | |
| 1066 } | 1082 } |
| 1067 | 1083 |
| 1068 // Create a URLRequestContextConfig from the given parameters. | 1084 // Create a URLRequestContextConfig from the given parameters. |
| 1069 static jlong CreateRequestContextConfig( | 1085 static jlong CreateRequestContextConfig( |
| 1070 JNIEnv* env, | 1086 JNIEnv* env, |
| 1071 const JavaParamRef<jclass>& jcaller, | 1087 const JavaParamRef<jclass>& jcaller, |
| 1072 const JavaParamRef<jstring>& juser_agent, | 1088 const JavaParamRef<jstring>& juser_agent, |
| 1073 const JavaParamRef<jstring>& jstorage_path, | 1089 const JavaParamRef<jstring>& jstorage_path, |
| 1074 jboolean jquic_enabled, | 1090 jboolean jquic_enabled, |
| 1075 const JavaParamRef<jstring>& jquic_default_user_agent_id, | 1091 const JavaParamRef<jstring>& jquic_default_user_agent_id, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1193 JNIEnv* env, | 1209 JNIEnv* env, |
| 1194 const JavaParamRef<jclass>& jcaller) { | 1210 const JavaParamRef<jclass>& jcaller) { |
| 1195 base::StatisticsRecorder::Initialize(); | 1211 base::StatisticsRecorder::Initialize(); |
| 1196 std::vector<uint8_t> data; | 1212 std::vector<uint8_t> data; |
| 1197 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1213 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 1198 return ScopedJavaLocalRef<jbyteArray>(); | 1214 return ScopedJavaLocalRef<jbyteArray>(); |
| 1199 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1215 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 1200 } | 1216 } |
| 1201 | 1217 |
| 1202 } // namespace cronet | 1218 } // namespace cronet |
| OLD | NEW |