Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 874543003: Add support for TraceEvent before the native library is loaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Selectively enable startup tracing in ChromeShell. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 1225
1226 std::string delay_str = command_line.GetSwitchValueASCII( 1226 std::string delay_str = command_line.GetSwitchValueASCII(
1227 switches::kTraceStartupDuration); 1227 switches::kTraceStartupDuration);
1228 int delay_secs = 5; 1228 int delay_secs = 5;
1229 if (!delay_str.empty() && !base::StringToInt(delay_str, &delay_secs)) { 1229 if (!delay_str.empty() && !base::StringToInt(delay_str, &delay_secs)) {
1230 DLOG(WARNING) << "Could not parse --" << switches::kTraceStartupDuration 1230 DLOG(WARNING) << "Could not parse --" << switches::kTraceStartupDuration
1231 << "=" << delay_str << " defaulting to 5 (secs)"; 1231 << "=" << delay_str << " defaulting to 5 (secs)";
1232 delay_secs = 5; 1232 delay_secs = 5;
1233 } 1233 }
1234 1234
1235 #if defined(OS_ANDROID)
1236 TracingControllerAndroid::SetupEarlyJavaTracing();
1237 #endif
1238
1235 startup_trace_timer_.Start(FROM_HERE, 1239 startup_trace_timer_.Start(FROM_HERE,
1236 base::TimeDelta::FromSeconds(delay_secs), 1240 base::TimeDelta::FromSeconds(delay_secs),
1237 this, 1241 this,
1238 &BrowserMainLoop::EndStartupTracing); 1242 &BrowserMainLoop::EndStartupTracing);
1239 } 1243 }
1240 1244
1241 void BrowserMainLoop::EndStartupTracing() { 1245 void BrowserMainLoop::EndStartupTracing() {
1242 is_tracing_startup_ = false; 1246 is_tracing_startup_ = false;
1247
1243 TracingController::GetInstance()->DisableRecording( 1248 TracingController::GetInstance()->DisableRecording(
1244 TracingController::CreateFileSink( 1249 TracingController::CreateFileSink(
1245 startup_trace_file_, 1250 startup_trace_file_,
1246 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1251 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1247 } 1252 }
1248 1253
1249 } // namespace content 1254 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698