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

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

Issue 232053002: Android: Fix default filename for kTraceStartup file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 6 years, 8 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 | Annotate | Revision Log
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/file_util.h" 10 #include "base/file_util.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "ui/base/clipboard/clipboard.h" 63 #include "ui/base/clipboard/clipboard.h"
64 64
65 #if defined(USE_AURA) 65 #if defined(USE_AURA)
66 #include "content/browser/compositor/image_transport_factory.h" 66 #include "content/browser/compositor/image_transport_factory.h"
67 #endif 67 #endif
68 68
69 #if defined(OS_ANDROID) 69 #if defined(OS_ANDROID)
70 #include "base/android/jni_android.h" 70 #include "base/android/jni_android.h"
71 #include "content/browser/android/browser_startup_controller.h" 71 #include "content/browser/android/browser_startup_controller.h"
72 #include "content/browser/android/surface_texture_peer_browser_impl.h" 72 #include "content/browser/android/surface_texture_peer_browser_impl.h"
73 #include "content/browser/android/tracing_controller_android.h"
73 #include "ui/gl/gl_surface.h" 74 #include "ui/gl/gl_surface.h"
74 #endif 75 #endif
75 76
76 #if defined(OS_MACOSX) && !defined(OS_IOS) 77 #if defined(OS_MACOSX) && !defined(OS_IOS)
77 #include "content/browser/theme_helper_mac.h" 78 #include "content/browser/theme_helper_mac.h"
78 #endif 79 #endif
79 80
80 #if defined(OS_WIN) 81 #if defined(OS_WIN)
81 #include <windows.h> 82 #include <windows.h>
82 #include <commctrl.h> 83 #include <commctrl.h>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 G_LOG_FLAG_FATAL | 247 G_LOG_FLAG_FATAL |
247 G_LOG_LEVEL_ERROR | 248 G_LOG_LEVEL_ERROR |
248 G_LOG_LEVEL_CRITICAL | 249 G_LOG_LEVEL_CRITICAL |
249 G_LOG_LEVEL_WARNING), 250 G_LOG_LEVEL_WARNING),
250 GLibLogHandler, 251 GLibLogHandler,
251 NULL); 252 NULL);
252 } 253 }
253 } 254 }
254 #endif 255 #endif
255 256
257 void OnStoppedStartupTracing(const base::FilePath& trace_file) {
258 LOG(INFO) << "Completed startup tracing to " << trace_file.value();
piman 2014/04/11 07:45:20 Hmm, I'm getting presubmit issues in a patch that
259 }
260
256 } // namespace 261 } // namespace
257 262
258 // The currently-running BrowserMainLoop. There can be one or zero. 263 // The currently-running BrowserMainLoop. There can be one or zero.
259 BrowserMainLoop* g_current_browser_main_loop = NULL; 264 BrowserMainLoop* g_current_browser_main_loop = NULL;
260 265
261 // This is just to be able to keep ShutdownThreadsAndCleanUp out of 266 // This is just to be able to keep ShutdownThreadsAndCleanUp out of
262 // the public interface of BrowserMainLoop. 267 // the public interface of BrowserMainLoop.
263 class BrowserShutdownImpl { 268 class BrowserShutdownImpl {
264 public: 269 public:
265 static void ImmediateShutdownAndExitProcess() { 270 static void ImmediateShutdownAndExitProcess() {
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1093
1089 base::FilePath trace_file = command_line.GetSwitchValuePath( 1094 base::FilePath trace_file = command_line.GetSwitchValuePath(
1090 switches::kTraceStartupFile); 1095 switches::kTraceStartupFile);
1091 // trace_file = "none" means that startup events will show up for the next 1096 // trace_file = "none" means that startup events will show up for the next
1092 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ 1097 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/
1093 // EndTracing, for example). 1098 // EndTracing, for example).
1094 if (trace_file == base::FilePath().AppendASCII("none")) 1099 if (trace_file == base::FilePath().AppendASCII("none"))
1095 return; 1100 return;
1096 1101
1097 if (trace_file.empty()) { 1102 if (trace_file.empty()) {
1103 #if defined(OS_ANDROID)
1104 TracingControllerAndroid::GenerateTracingFilePath(&trace_file);
1105 #else
1098 // Default to saving the startup trace into the current dir. 1106 // Default to saving the startup trace into the current dir.
1099 trace_file = base::FilePath().AppendASCII("chrometrace.log"); 1107 trace_file = base::FilePath().AppendASCII("chrometrace.log");
1108 #endif
1100 } 1109 }
1101 1110
1102 std::string delay_str = command_line.GetSwitchValueASCII( 1111 std::string delay_str = command_line.GetSwitchValueASCII(
1103 switches::kTraceStartupDuration); 1112 switches::kTraceStartupDuration);
1104 int delay_secs = 5; 1113 int delay_secs = 5;
1105 if (!delay_str.empty() && !base::StringToInt(delay_str, &delay_secs)) { 1114 if (!delay_str.empty() && !base::StringToInt(delay_str, &delay_secs)) {
1106 DLOG(WARNING) << "Could not parse --" << switches::kTraceStartupDuration 1115 DLOG(WARNING) << "Could not parse --" << switches::kTraceStartupDuration
1107 << "=" << delay_str << " defaulting to 5 (secs)"; 1116 << "=" << delay_str << " defaulting to 5 (secs)";
1108 delay_secs = 5; 1117 delay_secs = 5;
1109 } 1118 }
1110 1119
1111 BrowserThread::PostDelayedTask( 1120 BrowserThread::PostDelayedTask(
1112 BrowserThread::UI, FROM_HERE, 1121 BrowserThread::UI, FROM_HERE,
1113 base::Bind(&BrowserMainLoop::EndStartupTracing, 1122 base::Bind(&BrowserMainLoop::EndStartupTracing,
1114 base::Unretained(this), trace_file), 1123 base::Unretained(this), trace_file),
1115 base::TimeDelta::FromSeconds(delay_secs)); 1124 base::TimeDelta::FromSeconds(delay_secs));
1116 } 1125 }
1117 1126
1118 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { 1127 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) {
1119 is_tracing_startup_ = false; 1128 is_tracing_startup_ = false;
1120 TracingController::GetInstance()->DisableRecording( 1129 TracingController::GetInstance()->DisableRecording(
1121 trace_file, TracingController::TracingFileResultCallback()); 1130 trace_file, base::Bind(&OnStoppedStartupTracing));
1122 } 1131 }
1123 1132
1124 } // namespace content 1133 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698