| 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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 if (pref_service_) | 140 if (pref_service_) |
| 141 pref_service_->CommitPendingWrite(); | 141 pref_service_->CommitPendingWrite(); |
| 142 StopNetLogOnNetworkThread(); | 142 StopNetLogOnNetworkThread(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( | 145 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( |
| 146 JNIEnv* env, | 146 JNIEnv* env, |
| 147 jobject jcaller) { | 147 jobject jcaller) { |
| 148 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref; | 148 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref; |
| 149 jcaller_ref.Reset(env, jcaller); | 149 jcaller_ref.Reset(env, jcaller); |
| 150 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( | 150 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
| 151 GetNetworkTaskRunner(), nullptr)); | 151 GetNetworkTaskRunner(), nullptr); |
| 152 GetNetworkTaskRunner()->PostTask( | 152 GetNetworkTaskRunner()->PostTask( |
| 153 FROM_HERE, | 153 FROM_HERE, |
| 154 base::Bind(&CronetURLRequestContextAdapter::InitializeOnNetworkThread, | 154 base::Bind(&CronetURLRequestContextAdapter::InitializeOnNetworkThread, |
| 155 base::Unretained(this), Passed(&context_config_), | 155 base::Unretained(this), Passed(&context_config_), |
| 156 jcaller_ref)); | 156 jcaller_ref)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( | 159 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( |
| 160 scoped_ptr<URLRequestContextConfig> config, | 160 scoped_ptr<URLRequestContextConfig> config, |
| 161 const base::android::ScopedJavaGlobalRef<jobject>& | 161 const base::android::ScopedJavaGlobalRef<jobject>& |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 static jint SetMinLogLevel(JNIEnv* env, | 415 static jint SetMinLogLevel(JNIEnv* env, |
| 416 const JavaParamRef<jclass>& jcaller, | 416 const JavaParamRef<jclass>& jcaller, |
| 417 jint jlog_level) { | 417 jint jlog_level) { |
| 418 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); | 418 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); |
| 419 // MinLogLevel is global, shared by all URLRequestContexts. | 419 // MinLogLevel is global, shared by all URLRequestContexts. |
| 420 logging::SetMinLogLevel(static_cast<int>(jlog_level)); | 420 logging::SetMinLogLevel(static_cast<int>(jlog_level)); |
| 421 return old_log_level; | 421 return old_log_level; |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace cronet | 424 } // namespace cronet |
| OLD | NEW |