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/chromium_url_request_context.h" | 5 #include "components/cronet/android/chromium_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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 jstring jfilter) { | 122 jstring jfilter) { |
123 std::string query = ConvertJavaStringToUTF8(env, jfilter); | 123 std::string query = ConvertJavaStringToUTF8(env, jfilter); |
124 std::string json = base::StatisticsRecorder::ToJSON(query); | 124 std::string json = base::StatisticsRecorder::ToJSON(query); |
125 return ConvertUTF8ToJavaString(env, json).Release(); | 125 return ConvertUTF8ToJavaString(env, json).Release(); |
126 } | 126 } |
127 | 127 |
128 // Starts recording NetLog into file with |jfilename|. | 128 // Starts recording NetLog into file with |jfilename|. |
129 static void StartNetLogToFile(JNIEnv* env, | 129 static void StartNetLogToFile(JNIEnv* env, |
130 jobject jcaller, | 130 jobject jcaller, |
131 jlong jurl_request_context_adapter, | 131 jlong jurl_request_context_adapter, |
132 jstring jfilename) { | 132 jstring jfilename, |
| 133 jboolean jlog_all) { |
133 URLRequestContextAdapter* context_adapter = | 134 URLRequestContextAdapter* context_adapter = |
134 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); | 135 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); |
135 std::string filename = ConvertJavaStringToUTF8(env, jfilename); | 136 std::string filename = ConvertJavaStringToUTF8(env, jfilename); |
136 context_adapter->StartNetLogToFile(filename); | 137 context_adapter->StartNetLogToFile(filename, jlog_all); |
137 } | 138 } |
138 | 139 |
139 // Stops recording NetLog. | 140 // Stops recording NetLog. |
140 static void StopNetLog(JNIEnv* env, | 141 static void StopNetLog(JNIEnv* env, |
141 jobject jcaller, | 142 jobject jcaller, |
142 jlong jurl_request_context_adapter) { | 143 jlong jurl_request_context_adapter) { |
143 URLRequestContextAdapter* context_adapter = | 144 URLRequestContextAdapter* context_adapter = |
144 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); | 145 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); |
145 context_adapter->StopNetLog(); | 146 context_adapter->StopNetLog(); |
146 } | 147 } |
147 | 148 |
148 // Called on application's main Java thread. | 149 // Called on application's main Java thread. |
149 static void InitRequestContextOnMainThread(JNIEnv* env, | 150 static void InitRequestContextOnMainThread(JNIEnv* env, |
150 jobject jcaller, | 151 jobject jcaller, |
151 jlong jurl_request_context_adapter) { | 152 jlong jurl_request_context_adapter) { |
152 URLRequestContextAdapter* context_adapter = | 153 URLRequestContextAdapter* context_adapter = |
153 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); | 154 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); |
154 context_adapter->InitRequestContextOnMainThread(); | 155 context_adapter->InitRequestContextOnMainThread(); |
155 } | 156 } |
156 | 157 |
157 } // namespace cronet | 158 } // namespace cronet |
OLD | NEW |