| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (pref_service_) | 143 if (pref_service_) |
| 144 pref_service_->CommitPendingWrite(); | 144 pref_service_->CommitPendingWrite(); |
| 145 StopNetLogOnNetworkThread(); | 145 StopNetLogOnNetworkThread(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( | 148 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( |
| 149 JNIEnv* env, | 149 JNIEnv* env, |
| 150 jobject jcaller) { | 150 jobject jcaller) { |
| 151 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref; | 151 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref; |
| 152 jcaller_ref.Reset(env, jcaller); | 152 jcaller_ref.Reset(env, jcaller); |
| 153 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( | 153 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
| 154 GetNetworkTaskRunner(), nullptr)); | 154 GetNetworkTaskRunner(), nullptr); |
| 155 GetNetworkTaskRunner()->PostTask( | 155 GetNetworkTaskRunner()->PostTask( |
| 156 FROM_HERE, | 156 FROM_HERE, |
| 157 base::Bind(&CronetURLRequestContextAdapter::InitializeOnNetworkThread, | 157 base::Bind(&CronetURLRequestContextAdapter::InitializeOnNetworkThread, |
| 158 base::Unretained(this), Passed(&context_config_), | 158 base::Unretained(this), Passed(&context_config_), |
| 159 jcaller_ref)); | 159 jcaller_ref)); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( | 162 void CronetURLRequestContextAdapter::InitializeOnNetworkThread( |
| 163 scoped_ptr<URLRequestContextConfig> config, | 163 scoped_ptr<URLRequestContextConfig> config, |
| 164 const base::android::ScopedJavaGlobalRef<jobject>& | 164 const base::android::ScopedJavaGlobalRef<jobject>& |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 421 | 421 |
| 422 static jint SetMinLogLevel(JNIEnv* env, jclass jcaller, jint jlog_level) { | 422 static jint SetMinLogLevel(JNIEnv* env, jclass jcaller, jint jlog_level) { |
| 423 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); | 423 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); |
| 424 // MinLogLevel is global, shared by all URLRequestContexts. | 424 // MinLogLevel is global, shared by all URLRequestContexts. |
| 425 logging::SetMinLogLevel(static_cast<int>(jlog_level)); | 425 logging::SetMinLogLevel(static_cast<int>(jlog_level)); |
| 426 return old_log_level; | 426 return old_log_level; |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace cronet | 429 } // namespace cronet |
| OLD | NEW |