| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool 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 base::FilePath file_path( |
| 883 // Do nothing if already logging to a file. | 886 base::android::ConvertJavaStringToUTF8(env, jfile_name)); |
| 884 if (write_to_file_observer_) | |
| 885 return true; | |
| 886 std::string file_name = | |
| 887 base::android::ConvertJavaStringToUTF8(env, jfile_name); | |
| 888 base::FilePath file_path(file_name); | |
| 889 base::ScopedFILE file(base::OpenFile(file_path, "w")); | 887 base::ScopedFILE file(base::OpenFile(file_path, "w")); |
| 890 if (!file) { | 888 if (!file) { |
| 891 LOG(ERROR) << "Failed to open NetLog file for writing."; | 889 LOG(ERROR) << "Failed to open NetLog file for writing."; |
| 892 return false; | 890 return false; |
| 893 } | 891 } |
| 894 | 892 PostTaskToNetworkThread( |
| 895 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); | 893 FROM_HERE, |
| 896 if (jlog_all == JNI_TRUE) { | 894 base::Bind(&CronetURLRequestContextAdapter::StartNetLogOnNetworkThread, |
| 897 write_to_file_observer_->set_capture_mode( | 895 base::Unretained(this), file_path, jlog_all == JNI_TRUE)); |
| 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; | 896 return true; |
| 905 } | 897 } |
| 906 | 898 |
| 907 void CronetURLRequestContextAdapter::StartNetLogToDisk( | 899 void CronetURLRequestContextAdapter::StartNetLogToDisk( |
| 908 JNIEnv* env, | 900 JNIEnv* env, |
| 909 const JavaParamRef<jobject>& jcaller, | 901 const JavaParamRef<jobject>& jcaller, |
| 910 const JavaParamRef<jstring>& jdir_name, | 902 const JavaParamRef<jstring>& jdir_name, |
| 911 jboolean jlog_all, | 903 jboolean jlog_all, |
| 912 jint jmax_size) { | 904 jint jmax_size) { |
| 913 PostTaskToNetworkThread( | 905 PostTaskToNetworkThread( |
| 914 FROM_HERE, | 906 FROM_HERE, |
| 915 base::Bind(&CronetURLRequestContextAdapter:: | 907 base::Bind(&CronetURLRequestContextAdapter:: |
| 916 StartNetLogToBoundedFileOnNetworkThread, | 908 StartNetLogToBoundedFileOnNetworkThread, |
| 917 base::Unretained(this), | 909 base::Unretained(this), |
| 918 base::android::ConvertJavaStringToUTF8(env, jdir_name), | 910 base::android::ConvertJavaStringToUTF8(env, jdir_name), |
| 919 jlog_all, jmax_size)); | 911 jlog_all, jmax_size)); |
| 920 } | 912 } |
| 921 | 913 |
| 922 void CronetURLRequestContextAdapter::StopNetLog( | 914 void CronetURLRequestContextAdapter::StopNetLog( |
| 923 JNIEnv* env, | 915 JNIEnv* env, |
| 924 const JavaParamRef<jobject>& jcaller) { | 916 const JavaParamRef<jobject>& jcaller) { |
| 925 StopNetLogHelper(); | 917 DCHECK(!GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 918 PostTaskToNetworkThread( |
| 919 FROM_HERE, |
| 920 base::Bind(&CronetURLRequestContextAdapter::StopNetLogOnNetworkThread, |
| 921 base::Unretained(this))); |
| 926 } | 922 } |
| 927 | 923 |
| 928 void CronetURLRequestContextAdapter::GetCertVerifierData( | 924 void CronetURLRequestContextAdapter::GetCertVerifierData( |
| 929 JNIEnv* env, | 925 JNIEnv* env, |
| 930 const JavaParamRef<jobject>& jcaller) { | 926 const JavaParamRef<jobject>& jcaller) { |
| 931 PostTaskToNetworkThread( | 927 PostTaskToNetworkThread( |
| 932 FROM_HERE, | 928 FROM_HERE, |
| 933 base::Bind( | 929 base::Bind( |
| 934 &CronetURLRequestContextAdapter::GetCertVerifierDataOnNetworkThread, | 930 &CronetURLRequestContextAdapter::GetCertVerifierDataOnNetworkThread, |
| 935 base::Unretained(this))); | 931 base::Unretained(this))); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 void CronetURLRequestContextAdapter::OnThroughputObservation( | 998 void CronetURLRequestContextAdapter::OnThroughputObservation( |
| 1003 int32_t throughput_kbps, | 999 int32_t throughput_kbps, |
| 1004 const base::TimeTicks& timestamp, | 1000 const base::TimeTicks& timestamp, |
| 1005 net::NetworkQualityObservationSource source) { | 1001 net::NetworkQualityObservationSource source) { |
| 1006 Java_CronetUrlRequestContext_onThroughputObservation( | 1002 Java_CronetUrlRequestContext_onThroughputObservation( |
| 1007 base::android::AttachCurrentThread(), jcronet_url_request_context_, | 1003 base::android::AttachCurrentThread(), jcronet_url_request_context_, |
| 1008 throughput_kbps, | 1004 throughput_kbps, |
| 1009 (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(), source); | 1005 (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(), source); |
| 1010 } | 1006 } |
| 1011 | 1007 |
| 1008 void CronetURLRequestContextAdapter::StartNetLogOnNetworkThread( |
| 1009 const base::FilePath& file_path, |
| 1010 bool include_socket_bytes) { |
| 1011 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 1012 |
| 1013 // Do nothing if already logging to a file. |
| 1014 if (net_log_file_observer_) |
| 1015 return; |
| 1016 net_log_file_observer_ = net::FileNetLogObserver::CreateUnbounded( |
| 1017 GetFileThread()->task_runner(), file_path, /*constants=*/nullptr); |
| 1018 CreateNetLogEntriesForActiveObjects({context_.get()}, |
| 1019 net_log_file_observer_.get()); |
| 1020 net::NetLogCaptureMode capture_mode = |
| 1021 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() |
| 1022 : net::NetLogCaptureMode::Default(); |
| 1023 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(), |
| 1024 capture_mode); |
| 1025 } |
| 1026 |
| 1012 void CronetURLRequestContextAdapter::StartNetLogToBoundedFileOnNetworkThread( | 1027 void CronetURLRequestContextAdapter::StartNetLogToBoundedFileOnNetworkThread( |
| 1013 const std::string& dir_path, | 1028 const std::string& dir_path, |
| 1014 bool include_socket_bytes, | 1029 bool include_socket_bytes, |
| 1015 int size) { | 1030 int size) { |
| 1016 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 1031 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 1017 | 1032 |
| 1018 // Do nothing if already logging to a directory. | 1033 // Do nothing if already logging to a directory. |
| 1019 if (bounded_file_observer_) | 1034 if (net_log_file_observer_) |
| 1020 return; | 1035 return; |
| 1021 | 1036 |
| 1022 // Filepath for NetLog files must exist and be writable. | 1037 // Filepath for NetLog files must exist and be writable. |
| 1023 base::FilePath file_path(dir_path); | 1038 base::FilePath file_path(dir_path); |
| 1024 DCHECK(base::PathIsWritable(file_path)); | 1039 DCHECK(base::PathIsWritable(file_path)); |
| 1025 | 1040 |
| 1026 bounded_file_observer_ = net::FileNetLogObserver::CreateBounded( | 1041 net_log_file_observer_ = net::FileNetLogObserver::CreateBounded( |
| 1027 GetFileThread()->task_runner(), file_path, size, kNumNetLogEventFiles, | 1042 GetFileThread()->task_runner(), file_path, size, kNumNetLogEventFiles, |
| 1028 /*constants=*/nullptr); | 1043 /*constants=*/nullptr); |
| 1029 | 1044 |
| 1030 CreateNetLogEntriesForActiveObjects({context_.get()}, | 1045 CreateNetLogEntriesForActiveObjects({context_.get()}, |
| 1031 bounded_file_observer_.get()); | 1046 net_log_file_observer_.get()); |
| 1032 | 1047 |
| 1033 net::NetLogCaptureMode capture_mode = | 1048 net::NetLogCaptureMode capture_mode = |
| 1034 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() | 1049 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() |
| 1035 : net::NetLogCaptureMode::Default(); | 1050 : net::NetLogCaptureMode::Default(); |
| 1036 bounded_file_observer_->StartObserving(g_net_log.Get().net_log(), | 1051 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(), |
| 1037 capture_mode); | 1052 capture_mode); |
| 1038 } | 1053 } |
| 1039 | 1054 |
| 1040 void CronetURLRequestContextAdapter::StopBoundedFileNetLogOnNetworkThread() { | 1055 void CronetURLRequestContextAdapter::StopNetLogOnNetworkThread() { |
| 1041 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 1056 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 1042 bounded_file_observer_->StopObserving( | 1057 |
| 1043 net::GetNetInfo(context_.get(), net::NET_INFO_ALL_SOURCES), | 1058 if (!net_log_file_observer_) |
| 1059 return; |
| 1060 net_log_file_observer_->StopObserving( |
| 1061 GetNetLogInfo(), |
| 1044 base::Bind(&CronetURLRequestContextAdapter::StopNetLogCompleted, | 1062 base::Bind(&CronetURLRequestContextAdapter::StopNetLogCompleted, |
| 1045 base::Unretained(this))); | 1063 base::Unretained(this))); |
| 1046 bounded_file_observer_.reset(); | 1064 net_log_file_observer_.reset(); |
| 1047 } | 1065 } |
| 1048 | 1066 |
| 1049 void CronetURLRequestContextAdapter::StopNetLogCompleted() { | 1067 void CronetURLRequestContextAdapter::StopNetLogCompleted() { |
| 1050 Java_CronetUrlRequestContext_stopNetLogCompleted( | 1068 Java_CronetUrlRequestContext_stopNetLogCompleted( |
| 1051 base::android::AttachCurrentThread(), jcronet_url_request_context_.obj()); | 1069 base::android::AttachCurrentThread(), jcronet_url_request_context_.obj()); |
| 1052 } | 1070 } |
| 1053 | 1071 |
| 1054 void CronetURLRequestContextAdapter::StopNetLogHelper() { | 1072 std::unique_ptr<base::DictionaryValue> |
| 1055 base::AutoLock lock(write_to_file_observer_lock_); | 1073 CronetURLRequestContextAdapter::GetNetLogInfo() const { |
| 1056 DCHECK(!(write_to_file_observer_ && bounded_file_observer_)); | 1074 std::unique_ptr<base::DictionaryValue> net_info = |
| 1057 if (write_to_file_observer_) { | 1075 net::GetNetInfo(context_.get(), net::NET_INFO_ALL_SOURCES); |
| 1058 write_to_file_observer_->StopObserving(/*url_request_context=*/nullptr); | 1076 if (effective_experimental_options_) { |
| 1059 write_to_file_observer_.reset(); | 1077 net_info->Set("cronetExperimentalParams", |
| 1060 } else if (bounded_file_observer_) { | 1078 effective_experimental_options_->CreateDeepCopy()); |
| 1061 PostTaskToNetworkThread(FROM_HERE, | |
| 1062 base::Bind(&CronetURLRequestContextAdapter:: | |
| 1063 StopBoundedFileNetLogOnNetworkThread, | |
| 1064 base::Unretained(this))); | |
| 1065 } | 1079 } |
| 1080 return net_info; |
| 1066 } | 1081 } |
| 1067 | 1082 |
| 1068 // Create a URLRequestContextConfig from the given parameters. | 1083 // Create a URLRequestContextConfig from the given parameters. |
| 1069 static jlong CreateRequestContextConfig( | 1084 static jlong CreateRequestContextConfig( |
| 1070 JNIEnv* env, | 1085 JNIEnv* env, |
| 1071 const JavaParamRef<jclass>& jcaller, | 1086 const JavaParamRef<jclass>& jcaller, |
| 1072 const JavaParamRef<jstring>& juser_agent, | 1087 const JavaParamRef<jstring>& juser_agent, |
| 1073 const JavaParamRef<jstring>& jstorage_path, | 1088 const JavaParamRef<jstring>& jstorage_path, |
| 1074 jboolean jquic_enabled, | 1089 jboolean jquic_enabled, |
| 1075 const JavaParamRef<jstring>& jquic_default_user_agent_id, | 1090 const JavaParamRef<jstring>& jquic_default_user_agent_id, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 JNIEnv* env, | 1208 JNIEnv* env, |
| 1194 const JavaParamRef<jclass>& jcaller) { | 1209 const JavaParamRef<jclass>& jcaller) { |
| 1195 base::StatisticsRecorder::Initialize(); | 1210 base::StatisticsRecorder::Initialize(); |
| 1196 std::vector<uint8_t> data; | 1211 std::vector<uint8_t> data; |
| 1197 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1212 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 1198 return ScopedJavaLocalRef<jbyteArray>(); | 1213 return ScopedJavaLocalRef<jbyteArray>(); |
| 1199 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1214 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 1200 } | 1215 } |
| 1201 | 1216 |
| 1202 } // namespace cronet | 1217 } // namespace cronet |
| OLD | NEW |