Chromium Code Reviews| 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_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_registrar.h" | 9 #include "base/android/base_jni_registrar.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 return JNI_VERSION_1_6; | 80 return JNI_VERSION_1_6; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void CronetOnUnLoad(JavaVM* jvm, void* reserved) { | 83 void CronetOnUnLoad(JavaVM* jvm, void* reserved) { |
| 84 if (g_at_exit_manager) { | 84 if (g_at_exit_manager) { |
| 85 delete g_at_exit_manager; | 85 delete g_at_exit_manager; |
| 86 g_at_exit_manager = NULL; | 86 g_at_exit_manager = NULL; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 void CronetInitOnMainThread(JNIEnv* env, jclass jcaller, jobject japp_context) { | 90 void CronetInitApplicationContext(JNIEnv* env, |
| 91 jclass jcaller, | |
| 92 jobject japp_context) { | |
| 91 // Set application context. | 93 // Set application context. |
| 92 base::android::ScopedJavaLocalRef<jobject> scoped_app_context(env, | 94 base::android::ScopedJavaLocalRef<jobject> scoped_app_context(env, |
| 93 japp_context); | 95 japp_context); |
| 94 base::android::InitApplicationContext(env, scoped_app_context); | 96 base::android::InitApplicationContext(env, scoped_app_context); |
| 97 } | |
| 95 | 98 |
| 99 void CronetInitOnMainThread(JNIEnv* env, jclass jcaller) { | |
| 96 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID) | 100 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID) |
| 97 base::i18n::InitializeICU(); | 101 base::i18n::InitializeICU(); |
|
xunjieli
2015/03/09 18:13:21
Should we move this to CronetOnLoad and maybe afte
pauljensen
2015/03/09 19:04:36
How about in another CL? This seems orthogonal to
xunjieli
2015/03/09 19:37:50
SGTM
| |
| 98 #endif | 102 #endif |
| 99 | 103 |
| 100 DCHECK(!base::MessageLoop::current()); | 104 DCHECK(!base::MessageLoop::current()); |
| 101 DCHECK(!g_main_message_loop); | 105 DCHECK(!g_main_message_loop); |
| 102 g_main_message_loop = new base::MessageLoopForUI(); | 106 g_main_message_loop = new base::MessageLoopForUI(); |
| 103 base::MessageLoopForUI::current()->Start(); | 107 base::MessageLoopForUI::current()->Start(); |
| 104 DCHECK(!g_network_change_notifier); | 108 DCHECK(!g_network_change_notifier); |
| 105 net::NetworkChangeNotifier::SetFactory( | 109 net::NetworkChangeNotifier::SetFactory( |
| 106 new net::NetworkChangeNotifierFactoryAndroid()); | 110 new net::NetworkChangeNotifierFactoryAndroid()); |
| 107 g_network_change_notifier = net::NetworkChangeNotifier::Create(); | 111 g_network_change_notifier = net::NetworkChangeNotifier::Create(); |
| 108 } | 112 } |
| 109 | 113 |
| 110 } // namespace cronet | 114 } // namespace cronet |
| OLD | NEW |