diff options
author | andrewhayden@chromium.org <andrewhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 10:55:43 +0000 |
---|---|---|
committer | andrewhayden@chromium.org <andrewhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 10:55:43 +0000 |
commit | aa328c73297697e1d4846c0cb8ef7be7f8d80608 (patch) | |
tree | c855d573c138ce94c7d18ffff92b95780da543df /content/app | |
parent | b623b5f07d8e167f2cc2b79b5f7087b382dc2d2f (diff) | |
download | chromium_src-aa328c73297697e1d4846c0cb8ef7be7f8d80608.zip chromium_src-aa328c73297697e1d4846c0cb8ef7be7f8d80608.tar.gz chromium_src-aa328c73297697e1d4846c0cb8ef7be7f8d80608.tar.bz2 |
[Chromium] Add tracing to startup process, particularly for Android
BUG=222350
Review URL: https://chromiumcodereview.appspot.com/13820011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r-- | content/app/android/content_main.cc | 2 | ||||
-rw-r--r-- | content/app/content_main_runner.cc | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main.cc index 4059de4..e9cd1fd 100644 --- a/content/app/android/content_main.cc +++ b/content/app/android/content_main.cc @@ -7,6 +7,7 @@ #include "base/at_exit.h" #include "base/base_switches.h" #include "base/command_line.h" +#include "base/debug/trace_event.h" #include "base/lazy_instance.h" #include "content/public/app/content_main.h" #include "content/public/app/content_main_delegate.h" @@ -35,6 +36,7 @@ static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) { } static jint Start(JNIEnv* env, jclass clazz) { + TRACE_EVENT0("startup", "content::Start"); const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); // This is only for browser process. We want to start waiting as early as diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 0c054fb..9f1947a 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -507,6 +507,13 @@ class ContentMainRunnerImpl : public ContentMainRunner { const char** argv, ContentMainDelegate* delegate) OVERRIDE { +#if defined(OS_ANDROID) + // See note at the initialization of ExitManager, below; basically, + // only Android builds have the ctor/dtor handlers set up to use + // TRACE_EVENT right away. + TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); +#endif // OS_ANDROID + // NOTE(willchan): One might ask why these TCMalloc-related calls are done // here rather than in process_util_linux.cc with the definition of // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a @@ -576,6 +583,8 @@ class ContentMainRunnerImpl : public ContentMainRunner { // The exit manager is in charge of calling the dtors of singleton objects. // On Android, AtExitManager is set up when library is loaded. // On iOS, it's set up in main(), which can't call directly through to here. + // A consequence of this is that you can't use the ctor/dtor-based + // TRACE_EVENT methods on Linux or iOS builds till after we set this up. #if !defined(OS_ANDROID) && !defined(OS_IOS) exit_manager_.reset(new base::AtExitManager); #endif // !OS_ANDROID && !OS_IOS @@ -588,10 +597,11 @@ class ContentMainRunnerImpl : public ContentMainRunner { autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); #endif - // On Android, the command line is initialized when library is loaded. + // On Android, the command line is initialized when library is loaded and + // we have already started our TRACE_EVENT0. #if !defined(OS_ANDROID) CommandLine::Init(argc, argv); -#endif +#endif // !OS_ANDROID int exit_code; if (delegate && delegate->BasicStartupComplete(&exit_code)) @@ -622,6 +632,12 @@ class ContentMainRunnerImpl : public ContentMainRunner { category_filter, base::debug::TraceLog::RECORD_UNTIL_FULL); } +#if !defined(OS_ANDROID) + // Android tracing started at the beginning of the method. + // Other OSes have to wait till we get here in order for all the memory + // management setup to be completed. + TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); +#endif // !OS_ANDROID #if defined(OS_MACOSX) && !defined(OS_IOS) // We need to allocate the IO Ports before the Sandbox is initialized or |