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

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

Issue 1326763009: jni: Forbid inappropriate JNI parameter conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN-only mojo, and chromecast Created 5 years, 3 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/cronet_library_loader.h" 5 #include "components/cronet/android/cronet_library_loader.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/base_jni_onload.h" 9 #include "base/android/base_jni_onload.h"
10 #include "base/android/base_jni_registrar.h" 10 #include "base/android/base_jni_registrar.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void CronetOnUnLoad(JavaVM* jvm, void* reserved) { 85 void CronetOnUnLoad(JavaVM* jvm, void* reserved) {
86 base::android::LibraryLoaderExitHook(); 86 base::android::LibraryLoaderExitHook();
87 } 87 }
88 88
89 void CronetInitApplicationContext(JNIEnv* env, 89 void CronetInitApplicationContext(JNIEnv* env,
90 const JavaParamRef<jclass>& jcaller, 90 const JavaParamRef<jclass>& jcaller,
91 const JavaParamRef<jobject>& japp_context) { 91 const JavaParamRef<jobject>& japp_context) {
92 // Set application context. 92 // Set application context.
93 base::android::ScopedJavaLocalRef<jobject> scoped_app_context(env, 93 base::android::InitApplicationContext(env, japp_context);
94 japp_context);
95 base::android::InitApplicationContext(env, scoped_app_context);
96 } 94 }
97 95
98 void CronetInitOnMainThread(JNIEnv* env, const JavaParamRef<jclass>& jcaller) { 96 void CronetInitOnMainThread(JNIEnv* env, const JavaParamRef<jclass>& jcaller) {
99 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID) 97 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID)
100 base::i18n::InitializeICU(); 98 base::i18n::InitializeICU();
101 #endif 99 #endif
102 100
103 // TODO(bengr): Remove once Data Reduction Proxy no longer needs this for 101 // TODO(bengr): Remove once Data Reduction Proxy no longer needs this for
104 // configuration information. 102 // configuration information.
105 base::CommandLine::Init(0, nullptr); 103 base::CommandLine::Init(0, nullptr);
106 DCHECK(!base::MessageLoop::current()); 104 DCHECK(!base::MessageLoop::current());
107 DCHECK(!g_main_message_loop); 105 DCHECK(!g_main_message_loop);
108 g_main_message_loop = new base::MessageLoopForUI(); 106 g_main_message_loop = new base::MessageLoopForUI();
109 base::MessageLoopForUI::current()->Start(); 107 base::MessageLoopForUI::current()->Start();
110 DCHECK(!g_network_change_notifier); 108 DCHECK(!g_network_change_notifier);
111 net::NetworkChangeNotifier::SetFactory( 109 net::NetworkChangeNotifier::SetFactory(
112 new net::NetworkChangeNotifierFactoryAndroid()); 110 new net::NetworkChangeNotifierFactoryAndroid());
113 g_network_change_notifier = net::NetworkChangeNotifier::Create(); 111 g_network_change_notifier = net::NetworkChangeNotifier::Create();
114 } 112 }
115 113
116 ScopedJavaLocalRef<jstring> GetCronetVersion( 114 ScopedJavaLocalRef<jstring> GetCronetVersion(
117 JNIEnv* env, 115 JNIEnv* env,
118 const JavaParamRef<jclass>& jcaller) { 116 const JavaParamRef<jclass>& jcaller) {
119 return base::android::ConvertUTF8ToJavaString(env, CRONET_VERSION); 117 return base::android::ConvertUTF8ToJavaString(env, CRONET_VERSION);
120 } 118 }
121 119
122 } // namespace cronet 120 } // namespace cronet
OLDNEW
« no previous file with comments | « chromecast/browser/android/cast_window_manager.cc ('k') | content/shell/android/shell_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698