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

Side by Side Diff: components/cronet/android/test/quic_test_server.cc

Issue 1288183004: jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some newlines for readability 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "quic_test_server.h" 5 #include "quic_test_server.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_path.h" 10 #include "base/files/file_path.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 FROM_HERE, base::Bind(&ServeFilesFromDirectory, test_files_root)); 70 FROM_HERE, base::Bind(&ServeFilesFromDirectory, test_files_root));
71 } 71 }
72 72
73 void ShutdownQuicTestServer(JNIEnv* env, jclass /*jcaller*/) { 73 void ShutdownQuicTestServer(JNIEnv* env, jclass /*jcaller*/) {
74 DCHECK(!g_quic_server_thread->task_runner()->BelongsToCurrentThread()); 74 DCHECK(!g_quic_server_thread->task_runner()->BelongsToCurrentThread());
75 g_quic_server_thread->task_runner()->PostTask( 75 g_quic_server_thread->task_runner()->PostTask(
76 FROM_HERE, base::Bind(&ShutdownOnServerThread)); 76 FROM_HERE, base::Bind(&ShutdownOnServerThread));
77 delete g_quic_server_thread; 77 delete g_quic_server_thread;
78 } 78 }
79 79
80 jstring GetServerHost(JNIEnv* env, jclass /*jcaller*/) { 80 ScopedJavaLocalRef<jstring> GetServerHost(JNIEnv* env, jclass /*jcaller*/) {
81 return base::android::ConvertUTF8ToJavaString(env, kServerHost).Release(); 81 return base::android::ConvertUTF8ToJavaString(env, kServerHost);
82 } 82 }
83 83
84 int GetServerPort(JNIEnv* env, jclass /*jcaller*/) { 84 int GetServerPort(JNIEnv* env, jclass /*jcaller*/) {
85 return kServerPort; 85 return kServerPort;
86 } 86 }
87 87
88 bool RegisterQuicTestServer(JNIEnv* env) { 88 bool RegisterQuicTestServer(JNIEnv* env) {
89 return RegisterNativesImpl(env); 89 return RegisterNativesImpl(env);
90 } 90 }
91 91
92 } // namespace cronet 92 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698