OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/app/android/chrome_android_initializer.h" | 5 #include "chrome/app/android/chrome_android_initializer.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/library_loader/library_loader_hooks.h" | 8 #include "base/android/library_loader/library_loader_hooks.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/app/android/chrome_main_delegate_android.h" | 10 #include "chrome/app/android/chrome_main_delegate_android.h" |
11 #include "chrome/common/chrome_version_info.h" | 11 #include "chrome/common/chrome_version_info.h" |
12 #include "content/public/app/android_library_loader_hooks.h" | 12 #include "content/public/app/android_library_loader_hooks.h" |
13 #include "content/public/app/content_main.h" | 13 #include "content/public/app/content_main.h" |
14 #include "net/proxy/proxy_resolver_v8.h" | 14 #include "net/proxy/proxy_resolver_v8.h" |
15 | 15 |
16 jint RunChrome(JavaVM* vm, ChromeMainDelegateAndroid* main_delegate) { | 16 jint RunChrome(JavaVM* vm, ChromeMainDelegateAndroid* main_delegate) { |
17 base::android::InitVM(vm); | 17 base::android::InitVM(vm); |
18 JNIEnv* env = base::android::AttachCurrentThread(); | |
19 if (!base::android::RegisterLibraryLoaderEntryHook(env)) | |
20 return -1; | |
21 | 18 |
22 // Pass the library version number to content so that we can check it from the | 19 // Pass the library version number to content so that we can check it from the |
23 // Java side before continuing initialization | 20 // Java side before continuing initialization |
24 chrome::VersionInfo vi; | 21 chrome::VersionInfo vi; |
25 base::android::SetLibraryLoadedHook(&content::LibraryLoaded); | 22 base::android::SetLibraryLoadedHook(&content::LibraryLoaded); |
26 base::android::SetVersionNumber(vi.Version().c_str()); | 23 base::android::SetVersionNumber(vi.Version().c_str()); |
27 | 24 |
28 DCHECK(main_delegate); | 25 DCHECK(main_delegate); |
29 content::SetContentMainDelegate(main_delegate); | 26 content::SetContentMainDelegate(main_delegate); |
30 | 27 |
31 // http://crbug.com/173648 . V8's default isolate is used by ProxyResolverV8 | 28 // http://crbug.com/173648 . V8's default isolate is used by ProxyResolverV8 |
32 // to resolve PAC urls. The default isolate is created by static initializer | 29 // to resolve PAC urls. The default isolate is created by static initializer |
33 // on the shared library thread, and can only be looked up in that thread's | 30 // on the shared library thread, and can only be looked up in that thread's |
34 // TLS. | 31 // TLS. |
35 net::ProxyResolverV8::RememberDefaultIsolate(); | 32 net::ProxyResolverV8::RememberDefaultIsolate(); |
36 | 33 |
37 return JNI_VERSION_1_4; | 34 return JNI_VERSION_1_4; |
38 } | 35 } |
OLD | NEW |