From de52fb95509666be1062b50a78bea36adfbac183 Mon Sep 17 00:00:00 2001 From: zhenw Date: Thu, 27 Aug 2015 20:07:16 -0700 Subject: [Startup Tracing] Add --trace-config-file flag This CL adds --trace-config-file flag. Please see trace_config_file.h for details. Design doc: https://docs.google.com/document/d/1PgdXUOJF3WtEmYWUyGRbC2Fz2ICCZKO9jPvpLPRSHH8/edit?usp=sharing BUG=317481, 482098 Review URL: https://codereview.chromium.org/1315463002 Cr-Commit-Position: refs/heads/master@{#346062} --- content/app/android/library_loader_hooks.cc | 8 ++++++-- content/app/content_main_runner.cc | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'content/app') diff --git a/content/app/android/library_loader_hooks.cc b/content/app/android/library_loader_hooks.cc index 39ef2b0..2a1a3df 100644 --- a/content/app/android/library_loader_hooks.cc +++ b/content/app/android/library_loader_hooks.cc @@ -16,7 +16,7 @@ #include "base/strings/string_util.h" #include "base/trace_event/trace_event.h" #include "base/tracked_objects.h" -#include "components/tracing/startup_tracing.h" +#include "components/tracing/trace_config_file.h" #include "components/tracing/tracing_switches.h" #include "content/app/android/app_jni_registrar.h" #include "content/browser/android/browser_jni_registrar.h" @@ -94,7 +94,11 @@ bool LibraryLoaded(JNIEnv* env, jclass clazz) { base::trace_event::TraceLog::GetInstance()->SetEnabled( trace_config, base::trace_event::TraceLog::RECORDING_MODE); } else { - tracing::EnableStartupTracingIfConfigFileExists(); + if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) { + base::trace_event::TraceLog::GetInstance()->SetEnabled( + tracing::TraceConfigFile::GetInstance()->GetTraceConfig(), + base::trace_event::TraceLog::RECORDING_MODE); + } } // Android's main browser loop is custom so we set the browser diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 1a5e950..f35ed29 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -28,7 +28,7 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/trace_event/trace_event.h" -#include "components/tracing/startup_tracing.h" +#include "components/tracing/trace_config_file.h" #include "components/tracing/tracing_switches.h" #include "content/browser/browser_main.h" #include "content/common/set_process_title.h" @@ -629,9 +629,11 @@ class ContentMainRunnerImpl : public ContentMainRunner { base::trace_event::TraceLog::RECORDING_MODE); } else if (process_type != switches::kZygoteProcess && process_type != switches::kRendererProcess) { - // There is no need to schedule stopping tracing in this case. Telemetry - // will stop tracing on demand later. - tracing::EnableStartupTracingIfConfigFileExists(); + if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) { + base::trace_event::TraceLog::GetInstance()->SetEnabled( + tracing::TraceConfigFile::GetInstance()->GetTraceConfig(), + base::trace_event::TraceLog::RECORDING_MODE); + } } #if defined(OS_WIN) -- cgit v1.1