Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: components/cronet/android/chromium_url_request_context.cc

Issue 1308363003: Revert of jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 context_adapter->Release(); 110 context_adapter->Release();
111 } 111 }
112 112
113 // Starts recording statistics. 113 // Starts recording statistics.
114 static void InitializeStatistics(JNIEnv* env, jobject jcaller) { 114 static void InitializeStatistics(JNIEnv* env, jobject jcaller) {
115 base::StatisticsRecorder::Initialize(); 115 base::StatisticsRecorder::Initialize();
116 } 116 }
117 117
118 // Gets current statistics with |jfilter| as a substring as JSON text (an empty 118 // Gets current statistics with |jfilter| as a substring as JSON text (an empty
119 // |jfilter| will include all registered histograms). 119 // |jfilter| will include all registered histograms).
120 static ScopedJavaLocalRef<jstring> GetStatisticsJSON(JNIEnv* env, 120 static jstring GetStatisticsJSON(JNIEnv* env,
121 jobject jcaller, 121 jobject jcaller,
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); 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 jboolean jlog_all) {
134 URLRequestContextAdapter* context_adapter = 134 URLRequestContextAdapter* context_adapter =
135 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); 135 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter);
(...skipping 13 matching lines...) Expand all
149 // Called on application's main Java thread. 149 // Called on application's main Java thread.
150 static void InitRequestContextOnMainThread(JNIEnv* env, 150 static void InitRequestContextOnMainThread(JNIEnv* env,
151 jobject jcaller, 151 jobject jcaller,
152 jlong jurl_request_context_adapter) { 152 jlong jurl_request_context_adapter) {
153 URLRequestContextAdapter* context_adapter = 153 URLRequestContextAdapter* context_adapter =
154 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter); 154 reinterpret_cast<URLRequestContextAdapter*>(jurl_request_context_adapter);
155 context_adapter->InitRequestContextOnMainThread(); 155 context_adapter->InitRequestContextOnMainThread();
156 } 156 }
157 157
158 } // namespace cronet 158 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/android/chromium_url_request.cc ('k') | components/cronet/android/cronet_histogram_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698