Commit 68133595 authored by Tomasz Śniatowski's avatar Tomasz Śniatowski Committed by Commit Bot

Fix startup tracing to an arbitrary file Android

As a side effect of the tracing cleanups in https://crrev.com/c/1015647,
setting a custom startup trace file via --trace-startup-file stopped
working on Android. Fix by not hardcoding the call to generate a path,
so the switch is checked first.

Bug: 828993
Change-Id: Ifcfd0dc2ea41b09af0c409ba5d406eda5d920b8b
Reviewed-on: https://chromium-review.googlesource.com/1097326Reviewed-by: default avatarEhsan Chiniforooshan <chiniforooshan@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Tomasz Śniatowski <tsniatowski@vewd.com>
Cr-Commit-Position: refs/heads/master@{#569012}
parent 27efc9e9
......@@ -161,11 +161,9 @@ int TraceStartupConfig::GetStartupDuration() const {
return startup_duration_;
}
#if !defined(OS_ANDROID)
base::FilePath TraceStartupConfig::GetResultFile() const {
DCHECK(IsEnabled());
return result_file_;
}
#endif
} // namespace tracing
......@@ -43,15 +43,14 @@ namespace tracing {
// the result file after shutting the browser down.
//
// result_file: The file that contains the trace log. The default result
// file path is chrometrace.log. Chrome will dump the trace
// log to this file
// file path is chrometrace.log, except on Android, where the
// default path is generated by tracing controller. Chrome
// will dump the trace log to this file
// 1) after startup_duration if it is specified;
// 2) or after browser shutdown if startup duration is 0.
// One can also stop tracing and get the result by other ways,
// e.g., by DevTools. In that case, the trace log will not be
// saved to this file.
// Notice: This is not supported on Android. The result file
// path will be generated by tracing controller.
//
// The trace config file can be specified by the --trace-config-file flag on
// most platforms except on Android, e.g., --trace-config-file=path/to/file/.
......@@ -93,9 +92,7 @@ class TRACING_EXPORT TraceStartupConfig {
base::trace_event::TraceConfig GetTraceConfig() const;
int GetStartupDuration() const;
#if !defined(OS_ANDROID)
base::FilePath GetResultFile() const;
#endif
private:
// This allows constructor and destructor to be private and usable only
......
......@@ -1593,15 +1593,15 @@ void BrowserMainLoop::InitializeMojo() {
base::FilePath BrowserMainLoop::GetStartupTraceFileName() const {
base::FilePath trace_file;
#if defined(OS_ANDROID)
TracingControllerAndroid::GenerateTracingFilePath(&trace_file);
#else
trace_file = tracing::TraceStartupConfig::GetInstance()->GetResultFile();
if (trace_file.empty()) {
#if defined(OS_ANDROID)
TracingControllerAndroid::GenerateTracingFilePath(&trace_file);
#else
// Default to saving the startup trace into the current dir.
trace_file = base::FilePath().AppendASCII("chrometrace.log");
}
#endif
}
return trace_file;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment