| 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.h" | 5 #include "components/cronet/android/cronet_url_request_context.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 context_adapter->StopNetLog(); | 99 context_adapter->StopNetLog(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 static jint SetMinLogLevel(JNIEnv* env, jobject jcaller, jint jlog_level) { | 102 static jint SetMinLogLevel(JNIEnv* env, jobject jcaller, jint jlog_level) { |
| 103 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); | 103 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); |
| 104 // MinLogLevel is global, shared by all URLRequestContexts. | 104 // MinLogLevel is global, shared by all URLRequestContexts. |
| 105 logging::SetMinLogLevel(static_cast<int>(jlog_level)); | 105 logging::SetMinLogLevel(static_cast<int>(jlog_level)); |
| 106 return old_log_level; | 106 return old_log_level; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Called on application's main Java thread. |
| 110 static void InitRequestContextOnMainThread(JNIEnv* env, |
| 111 jobject jcaller, |
| 112 jlong jurl_request_context_adapter) { |
| 113 if (jurl_request_context_adapter == 0) |
| 114 return; |
| 115 CronetURLRequestContextAdapter* context_adapter = |
| 116 reinterpret_cast<CronetURLRequestContextAdapter*>( |
| 117 jurl_request_context_adapter); |
| 118 context_adapter->InitRequestContextOnMainThread(); |
| 119 } |
| 120 |
| 109 } // namespace cronet | 121 } // namespace cronet |
| OLD | NEW |