Index: content/browser/browser_main_loop.cc |
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
index 6aef2203bc85693c3124773b35134905b5bf99c7..5a557a93a579d8dfa0165e458010b7144d3bde93 100644 |
--- a/content/browser/browser_main_loop.cc |
+++ b/content/browser/browser_main_loop.cc |
@@ -43,6 +43,7 @@ |
#include "content/browser/speech/speech_recognition_manager_impl.h" |
#include "content/browser/startup_task_runner.h" |
#include "content/browser/time_zone_monitor.h" |
+#include "content/browser/tracing/add_new_file_index.h" |
#include "content/browser/webui/content_web_ui_controller_factory.h" |
#include "content/browser/webui/url_data_manager.h" |
#include "content/public/browser/browser_main_parts.h" |
@@ -901,6 +902,10 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
} |
} |
+void BrowserMainLoop::StopStartupTracingTimer() { |
+ startup_trace_timer_.Stop(); |
+} |
+ |
void BrowserMainLoop::InitializeMainThread() { |
TRACE_EVENT0("startup", "BrowserMainLoop::InitializeMainThread"); |
const char* kThreadName = "CrBrowserMain"; |
@@ -1121,6 +1126,11 @@ void BrowserMainLoop::InitStartupTracing(const CommandLine& command_line) { |
#endif |
} |
+ if (command_line.HasSwitch(switches::kTraceRotateStartupFile)) |
+ trace_file = AddNewLogFileIndex(trace_file); |
+ |
+ startup_trace_file_ = trace_file; |
+ |
std::string delay_str = command_line.GetSwitchValueASCII( |
switches::kTraceStartupDuration); |
int delay_secs = 5; |
@@ -1130,17 +1140,16 @@ void BrowserMainLoop::InitStartupTracing(const CommandLine& command_line) { |
delay_secs = 5; |
} |
- BrowserThread::PostDelayedTask( |
- BrowserThread::UI, FROM_HERE, |
- base::Bind(&BrowserMainLoop::EndStartupTracing, |
- base::Unretained(this), trace_file), |
- base::TimeDelta::FromSeconds(delay_secs)); |
+ startup_trace_timer_.Start(FROM_HERE, |
+ base::TimeDelta::FromSeconds(delay_secs), |
+ this, |
+ &BrowserMainLoop::EndStartupTracing); |
} |
-void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { |
+void BrowserMainLoop::EndStartupTracing() { |
is_tracing_startup_ = false; |
TracingController::GetInstance()->DisableRecording( |
- trace_file, base::Bind(&OnStoppedStartupTracing)); |
+ startup_trace_file_, base::Bind(&OnStoppedStartupTracing)); |
} |
} // namespace content |