| 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 jcontext) { | 90 void CronetInitOnMainThread(JNIEnv* env, jclass jcaller, jobject japp_context) { |
| 91 // Set application context. | 91 // Set application context. |
| 92 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, jcontext); | 92 base::android::ScopedJavaLocalRef<jobject> scoped_app_context(env, |
| 93 base::android::InitApplicationContext(env, scoped_context); | 93 japp_context); |
| 94 base::android::InitApplicationContext(env, scoped_app_context); |
| 94 | 95 |
| 95 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID) | 96 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID) |
| 96 base::i18n::InitializeICU(); | 97 base::i18n::InitializeICU(); |
| 97 #endif | 98 #endif |
| 98 | 99 |
| 99 DCHECK(!base::MessageLoop::current()); | 100 DCHECK(!base::MessageLoop::current()); |
| 100 DCHECK(!g_main_message_loop); | 101 DCHECK(!g_main_message_loop); |
| 101 g_main_message_loop = new base::MessageLoopForUI(); | 102 g_main_message_loop = new base::MessageLoopForUI(); |
| 102 base::MessageLoopForUI::current()->Start(); | 103 base::MessageLoopForUI::current()->Start(); |
| 103 DCHECK(!g_network_change_notifier); | 104 DCHECK(!g_network_change_notifier); |
| 104 net::NetworkChangeNotifier::SetFactory( | 105 net::NetworkChangeNotifier::SetFactory( |
| 105 new net::NetworkChangeNotifierFactoryAndroid()); | 106 new net::NetworkChangeNotifierFactoryAndroid()); |
| 106 g_network_change_notifier = net::NetworkChangeNotifier::Create(); | 107 g_network_change_notifier = net::NetworkChangeNotifier::Create(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 } // namespace cronet | 110 } // namespace cronet |
| OLD | NEW |