Index: content/browser/browser_main.cc |
diff --git a/content/browser/browser_main.cc b/content/browser/browser_main.cc |
index 4c114b436133f6823324dc4be39bfe72e79de093..d0897f1d650d3baa6d8a4e8298d2cbe6ec2a7d8a 100644 |
--- a/content/browser/browser_main.cc |
+++ b/content/browser/browser_main.cc |
@@ -10,9 +10,27 @@ |
namespace content { |
+namespace { |
+ |
+// Generates a pair of BrowserMain async events. We don't use the TRACE_EVENT0 |
+// macro because the tracing infrastructure doesn't expect synchronous events |
+// around the main loop of a thread. |
+class ScopedBrowserMainEvent { |
+ public: |
+ ScopedBrowserMainEvent() { |
+ TRACE_EVENT_ASYNC_BEGIN0("startup", "BrowserMain", 0); |
+ } |
+ ~ScopedBrowserMainEvent() { |
+ TRACE_EVENT_ASYNC_END0("startup", "BrowserMain", 0); |
+ } |
+}; |
+ |
+} // namespace |
+ |
// Main routine for running as the Browser process. |
int BrowserMain(const MainFunctionParams& parameters) { |
- TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); |
+ ScopedBrowserMainEvent scoped_browser_main_event; |
+ |
base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser"); |
base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( |
kTraceEventBrowserProcessSortIndex); |
@@ -27,8 +45,6 @@ int BrowserMain(const MainFunctionParams& parameters) { |
main_runner->Shutdown(); |
- TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
- |
return exit_code; |
} |