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_main_delegate_android.h" | 5 #include "chrome/app/android/chrome_main_delegate_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "chrome/browser/android/chrome_jni_registrar.h" | 9 #include "chrome/browser/android/chrome_jni_registrar.h" |
10 #include "chrome/browser/android/chrome_startup_flags.h" | 10 #include "chrome/browser/android/chrome_startup_flags.h" |
| 11 #include "chrome/common/android/startup_metric_utils_android.h" |
| 12 #include "chrome/common/startup_metric_utils.h" |
11 #include "content/public/browser/browser_main_runner.h" | 13 #include "content/public/browser/browser_main_runner.h" |
12 | 14 |
13 // ChromeMainDelegateAndroid is created when the library is loaded. It is always | 15 // ChromeMainDelegateAndroid is created when the library is loaded. It is always |
14 // done in the process's main Java thread. But for non browser process, e.g. | 16 // done in the process's main Java thread. But for non browser process, e.g. |
15 // renderer process, it is not the native Chrome's main thread. | 17 // renderer process, it is not the native Chrome's main thread. |
16 ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() { | 18 ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() { |
17 } | 19 } |
18 | 20 |
19 ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() { | 21 ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() { |
20 } | 22 } |
21 | 23 |
22 void ChromeMainDelegateAndroid::SandboxInitialized( | 24 void ChromeMainDelegateAndroid::SandboxInitialized( |
23 const std::string& process_type) { | 25 const std::string& process_type) { |
24 ChromeMainDelegate::SandboxInitialized(process_type); | 26 ChromeMainDelegate::SandboxInitialized(process_type); |
25 } | 27 } |
26 | 28 |
27 int ChromeMainDelegateAndroid::RunProcess( | 29 int ChromeMainDelegateAndroid::RunProcess( |
28 const std::string& process_type, | 30 const std::string& process_type, |
29 const content::MainFunctionParams& main_function_params) { | 31 const content::MainFunctionParams& main_function_params) { |
30 TRACE_EVENT0("startup", "ChromeMainDelegateAndroid::RunProcess") | 32 TRACE_EVENT0("startup", "ChromeMainDelegateAndroid::RunProcess") |
31 if (process_type.empty()) { | 33 if (process_type.empty()) { |
32 JNIEnv* env = base::android::AttachCurrentThread(); | 34 JNIEnv* env = base::android::AttachCurrentThread(); |
33 RegisterApplicationNativeMethods(env); | 35 RegisterApplicationNativeMethods(env); |
34 | 36 |
| 37 base::Time startTime = chrome::android::GetMainEntryPointTime(); |
| 38 startup_metric_utils::RecordSavedMainEntryPointTime(startTime); |
| 39 |
35 browser_runner_.reset(content::BrowserMainRunner::Create()); | 40 browser_runner_.reset(content::BrowserMainRunner::Create()); |
36 return browser_runner_->Initialize(main_function_params); | 41 return browser_runner_->Initialize(main_function_params); |
37 } | 42 } |
38 | 43 |
39 return ChromeMainDelegate::RunProcess(process_type, main_function_params); | 44 return ChromeMainDelegate::RunProcess(process_type, main_function_params); |
40 } | 45 } |
41 | 46 |
42 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { | 47 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { |
43 SetChromeSpecificCommandLineFlags(); | 48 SetChromeSpecificCommandLineFlags(); |
44 return ChromeMainDelegate::BasicStartupComplete(exit_code); | 49 return ChromeMainDelegate::BasicStartupComplete(exit_code); |
45 } | 50 } |
46 | 51 |
47 bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) { | 52 bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) { |
48 return chrome::android::RegisterJni(env); | 53 return chrome::android::RegisterJni(env); |
49 } | 54 } |
OLD | NEW |