| 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 "content/public/browser/android_library_loader_hooks.h" | 5 #include "content/public/browser/android_library_loader_hooks.h" |
| 6 | 6 |
| 7 #include "base/android/base_jni_registrar.h" | 7 #include "base/android/base_jni_registrar.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/string_tokenizer.h" | 15 #include "base/string_tokenizer.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/tracked_objects.h" | 17 #include "base/tracked_objects.h" |
| 18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 19 #include "media/base/android/media_jni_registrar.h" | 19 #include "media/base/android/media_jni_registrar.h" |
| 20 #include "net/android/net_jni_registrar.h" |
| 20 | 21 |
| 21 jboolean LibraryLoaderEntryHook(JNIEnv* env, jclass clazz, | 22 jboolean LibraryLoaderEntryHook(JNIEnv* env, jclass clazz, |
| 22 jobjectArray init_command_line) { | 23 jobjectArray init_command_line) { |
| 23 | 24 |
| 24 // TODO(tedchoc): Initialize the native command line from the java array | 25 // TODO(tedchoc): Initialize the native command line from the java array |
| 25 // passed in. | 26 // passed in. |
| 26 | 27 |
| 27 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 28 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 28 | 29 |
| 29 if (command_line->HasSwitch(switches::kTraceStartup)) { | 30 if (command_line->HasSwitch(switches::kTraceStartup)) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 43 logging::SetLogItems(false, // Process ID | 44 logging::SetLogItems(false, // Process ID |
| 44 false, // Thread ID | 45 false, // Thread ID |
| 45 false, // Timestamp | 46 false, // Timestamp |
| 46 false); // Tick count | 47 false); // Tick count |
| 47 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() | 48 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() |
| 48 << ", default verbosity = " << logging::GetVlogVerbosity(); | 49 << ", default verbosity = " << logging::GetVlogVerbosity(); |
| 49 | 50 |
| 50 if (!base::android::RegisterJni(env)) | 51 if (!base::android::RegisterJni(env)) |
| 51 return JNI_FALSE; | 52 return JNI_FALSE; |
| 52 | 53 |
| 53 // TODO(yfriedman): Add net registration. | 54 if (!net::android::RegisterJni(env)) |
| 55 return JNI_FALSE; |
| 54 | 56 |
| 55 if (!media::RegisterJni(env)) | 57 if (!media::RegisterJni(env)) |
| 56 return JNI_FALSE; | 58 return JNI_FALSE; |
| 57 | 59 |
| 58 return JNI_TRUE; | 60 return JNI_TRUE; |
| 59 } | 61 } |
| 60 | 62 |
| 61 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { | 63 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { |
| 62 // TODO(bulach): use the jni generator once we move jni_helper methods here. | 64 // TODO(bulach): use the jni generator once we move jni_helper methods here. |
| 63 const JNINativeMethod kMethods[] = { | 65 const JNINativeMethod kMethods[] = { |
| 64 { "nativeLibraryLoadedOnMainThread", "([Ljava/lang/String;)Z", | 66 { "nativeLibraryLoadedOnMainThread", "([Ljava/lang/String;)Z", |
| 65 reinterpret_cast<void*>(LibraryLoaderEntryHook) }, | 67 reinterpret_cast<void*>(LibraryLoaderEntryHook) }, |
| 66 }; | 68 }; |
| 67 const int kMethodsSize = arraysize(kMethods); | 69 const int kMethodsSize = arraysize(kMethods); |
| 68 // TODO(tedchoc): Upstream LibraryLoader.java and replace path to make this | 70 // TODO(tedchoc): Upstream LibraryLoader.java and replace path to make this |
| 69 // work. | 71 // work. |
| 70 const char kLibraryLoaderPath[] = ""; | 72 const char kLibraryLoaderPath[] = ""; |
| 71 base::android::ScopedJavaLocalRef<jclass> clazz = | 73 base::android::ScopedJavaLocalRef<jclass> clazz = |
| 72 base::android::GetClass(env, kLibraryLoaderPath); | 74 base::android::GetClass(env, kLibraryLoaderPath); |
| 73 | 75 |
| 74 if (env->RegisterNatives(clazz.obj(), | 76 if (env->RegisterNatives(clazz.obj(), |
| 75 kMethods, | 77 kMethods, |
| 76 kMethodsSize) < 0) { | 78 kMethodsSize) < 0) { |
| 77 return false; | 79 return false; |
| 78 } | 80 } |
| 79 return true; | 81 return true; |
| 80 } | 82 } |
| OLD | NEW |