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/app/android_library_loader_hooks.h" | 5 #include "content/public/app/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_registrar.h" | 8 #include "base/android/jni_registrar.h" |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/base_switches.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
14 #include "base/file_path.h" | 15 #include "base/file_path.h" |
15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/string_tokenizer.h" | 18 #include "base/string_tokenizer.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "base/tracked_objects.h" | 20 #include "base/tracked_objects.h" |
20 #include "content/app/android/app_jni_registrar.h" | 21 #include "content/app/android/app_jni_registrar.h" |
21 #include "content/browser/android/browser_jni_registrar.h" | 22 #include "content/browser/android/browser_jni_registrar.h" |
(...skipping 19 matching lines...) Expand all Loading... |
41 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 42 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
42 | 43 |
43 if (command_line->HasSwitch(switches::kTraceStartup)) { | 44 if (command_line->HasSwitch(switches::kTraceStartup)) { |
44 base::debug::TraceLog::GetInstance()->SetEnabled( | 45 base::debug::TraceLog::GetInstance()->SetEnabled( |
45 command_line->GetSwitchValueASCII(switches::kTraceStartup)); | 46 command_line->GetSwitchValueASCII(switches::kTraceStartup)); |
46 } | 47 } |
47 | 48 |
48 // Can only use event tracing after setting up the command line. | 49 // Can only use event tracing after setting up the command line. |
49 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); | 50 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); |
50 | 51 |
| 52 // Note: because logging is setup here right after copying the command line |
| 53 // array from java to native up top of this method, any code that adds the |
| 54 // --enable-dcheck switch must do so on the Java side. |
| 55 logging::DcheckState dcheck_state = |
| 56 command_line->HasSwitch(switches::kEnableDCHECK) ? |
| 57 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : |
| 58 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
51 logging::InitLogging(NULL, | 59 logging::InitLogging(NULL, |
52 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 60 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
53 logging::DONT_LOCK_LOG_FILE, | 61 logging::DONT_LOCK_LOG_FILE, |
54 logging::DELETE_OLD_LOG_FILE, | 62 logging::DELETE_OLD_LOG_FILE, |
55 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 63 dcheck_state); |
56 // To view log output with IDs and timestamps use "adb logcat -v threadtime". | 64 // To view log output with IDs and timestamps use "adb logcat -v threadtime". |
57 logging::SetLogItems(false, // Process ID | 65 logging::SetLogItems(false, // Process ID |
58 false, // Thread ID | 66 false, // Thread ID |
59 false, // Timestamp | 67 false, // Timestamp |
60 false); // Tick count | 68 false); // Tick count |
61 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() | 69 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() |
62 << ", default verbosity = " << logging::GetVlogVerbosity(); | 70 << ", default verbosity = " << logging::GetVlogVerbosity(); |
63 | 71 |
64 if (!base::android::RegisterJni(env)) | 72 if (!base::android::RegisterJni(env)) |
65 return JNI_FALSE; | 73 return JNI_FALSE; |
(...skipping 30 matching lines...) Expand all Loading... |
96 } | 104 } |
97 | 105 |
98 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { | 106 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { |
99 // We need the AtExitManager to be created at the very beginning. | 107 // We need the AtExitManager to be created at the very beginning. |
100 g_at_exit_manager = new base::AtExitManager(); | 108 g_at_exit_manager = new base::AtExitManager(); |
101 | 109 |
102 return RegisterNativesImpl(env); | 110 return RegisterNativesImpl(env); |
103 } | 111 } |
104 | 112 |
105 } // namespace content | 113 } // namespace content |
OLD | NEW |