| 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 19 matching lines...) Expand all Loading... |
| 30 #include "base/memory/scoped_vector.h" | 30 #include "base/memory/scoped_vector.h" |
| 31 #include "base/message_loop/message_loop.h" | 31 #include "base/message_loop/message_loop.h" |
| 32 #include "base/metrics/histogram_macros.h" | 32 #include "base/metrics/histogram_macros.h" |
| 33 #include "base/metrics/statistics_recorder.h" | 33 #include "base/metrics/statistics_recorder.h" |
| 34 #include "base/single_thread_task_runner.h" | 34 #include "base/single_thread_task_runner.h" |
| 35 #include "base/threading/thread_task_runner_handle.h" | 35 #include "base/threading/thread_task_runner_handle.h" |
| 36 #include "base/time/time.h" | 36 #include "base/time/time.h" |
| 37 #include "base/values.h" | 37 #include "base/values.h" |
| 38 #include "components/cronet/android/cert/cert_verifier_cache_serializer.h" | 38 #include "components/cronet/android/cert/cert_verifier_cache_serializer.h" |
| 39 #include "components/cronet/android/cert/proto/cert_verification.pb.h" | 39 #include "components/cronet/android/cert/proto/cert_verification.pb.h" |
| 40 #include "components/cronet/android/network_change_notifier_initer.h" |
| 40 #include "components/cronet/histogram_manager.h" | 41 #include "components/cronet/histogram_manager.h" |
| 41 #include "components/cronet/url_request_context_config.h" | 42 #include "components/cronet/url_request_context_config.h" |
| 42 #include "components/prefs/pref_change_registrar.h" | 43 #include "components/prefs/pref_change_registrar.h" |
| 43 #include "components/prefs/pref_filter.h" | 44 #include "components/prefs/pref_filter.h" |
| 44 #include "components/prefs/pref_registry.h" | 45 #include "components/prefs/pref_registry.h" |
| 45 #include "components/prefs/pref_registry_simple.h" | 46 #include "components/prefs/pref_registry_simple.h" |
| 46 #include "components/prefs/pref_service.h" | 47 #include "components/prefs/pref_service.h" |
| 47 #include "components/prefs/pref_service_factory.h" | 48 #include "components/prefs/pref_service_factory.h" |
| 48 #include "jni/CronetUrlRequestContext_jni.h" | 49 #include "jni/CronetUrlRequestContext_jni.h" |
| 49 #include "net/base/load_flags.h" | 50 #include "net/base/load_flags.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 604 } |
| 604 | 605 |
| 605 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( | 606 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( |
| 606 std::unique_ptr<URLRequestContextConfig> config, | 607 std::unique_ptr<URLRequestContextConfig> config, |
| 607 const base::android::ScopedJavaGlobalRef<jobject>& | 608 const base::android::ScopedJavaGlobalRef<jobject>& |
| 608 jcronet_url_request_context) { | 609 jcronet_url_request_context) { |
| 609 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 610 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 610 DCHECK(!is_context_initialized_); | 611 DCHECK(!is_context_initialized_); |
| 611 DCHECK(proxy_config_service_); | 612 DCHECK(proxy_config_service_); |
| 612 | 613 |
| 614 NetworkChangeNotifierInit(); |
| 615 |
| 613 // TODO(mmenke): Add method to have the builder enable SPDY. | 616 // TODO(mmenke): Add method to have the builder enable SPDY. |
| 614 net::URLRequestContextBuilder context_builder; | 617 net::URLRequestContextBuilder context_builder; |
| 615 | 618 |
| 616 std::unique_ptr<net::NetworkDelegate> network_delegate( | 619 std::unique_ptr<net::NetworkDelegate> network_delegate( |
| 617 new BasicNetworkDelegate()); | 620 new BasicNetworkDelegate()); |
| 618 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 621 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 619 DCHECK(!data_reduction_proxy_); | 622 DCHECK(!data_reduction_proxy_); |
| 620 // For now, the choice to enable the data reduction proxy happens once, | 623 // For now, the choice to enable the data reduction proxy happens once, |
| 621 // at initialization. It cannot be disabled thereafter. | 624 // at initialization. It cannot be disabled thereafter. |
| 622 if (!config->data_reduction_proxy_key.empty()) { | 625 if (!config->data_reduction_proxy_key.empty()) { |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 JNIEnv* env, | 1211 JNIEnv* env, |
| 1209 const JavaParamRef<jclass>& jcaller) { | 1212 const JavaParamRef<jclass>& jcaller) { |
| 1210 base::StatisticsRecorder::Initialize(); | 1213 base::StatisticsRecorder::Initialize(); |
| 1211 std::vector<uint8_t> data; | 1214 std::vector<uint8_t> data; |
| 1212 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1215 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 1213 return ScopedJavaLocalRef<jbyteArray>(); | 1216 return ScopedJavaLocalRef<jbyteArray>(); |
| 1214 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1217 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 1215 } | 1218 } |
| 1216 | 1219 |
| 1217 } // namespace cronet | 1220 } // namespace cronet |
| OLD | NEW |