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

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

Issue 2694083005: memory-infra: Finish moving memory_infra from TracingController (Closed)
Patch Set: style: auto must not deduce to raw pointer Created 3 years, 9 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.h" 5 #include "content/browser/browser_main.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/trace_event/memory_dump_manager.h"
9 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "content/common/child_process_host_impl.h"
10 #include "content/common/content_constants_internal.h" 12 #include "content/common/content_constants_internal.h"
11 #include "content/public/browser/browser_main_runner.h" 13 #include "content/public/browser/browser_main_runner.h"
12 14
13 namespace content { 15 namespace content {
14 16
15 namespace { 17 namespace {
16 18
17 // Generates a pair of BrowserMain async events. We don't use the TRACE_EVENT0 19 // Generates a pair of BrowserMain async events. We don't use the TRACE_EVENT0
18 // macro because the tracing infrastructure doesn't expect synchronous events 20 // macro because the tracing infrastructure doesn't expect synchronous events
19 // around the main loop of a thread. 21 // around the main loop of a thread.
20 class ScopedBrowserMainEvent { 22 class ScopedBrowserMainEvent {
21 public: 23 public:
22 ScopedBrowserMainEvent() { 24 ScopedBrowserMainEvent() {
23 TRACE_EVENT_ASYNC_BEGIN0("startup", "BrowserMain", 0); 25 TRACE_EVENT_ASYNC_BEGIN0("startup", "BrowserMain", 0);
24 } 26 }
25 ~ScopedBrowserMainEvent() { 27 ~ScopedBrowserMainEvent() {
26 TRACE_EVENT_ASYNC_END0("startup", "BrowserMain", 0); 28 TRACE_EVENT_ASYNC_END0("startup", "BrowserMain", 0);
27 } 29 }
28 }; 30 };
29 31
30 } // namespace 32 } // namespace
31 33
32 // Main routine for running as the Browser process. 34 // Main routine for running as the Browser process.
33 int BrowserMain(const MainFunctionParams& parameters) { 35 int BrowserMain(const MainFunctionParams& parameters) {
34 ScopedBrowserMainEvent scoped_browser_main_event; 36 ScopedBrowserMainEvent scoped_browser_main_event;
35 37
36 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser"); 38 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser");
37 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( 39 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
38 kTraceEventBrowserProcessSortIndex); 40 kTraceEventBrowserProcessSortIndex);
39 41 base::trace_event::MemoryDumpManager::GetInstance()->set_tracing_process_id(
42 ChildProcessHost::kBrowserTracingProcessId);
40 std::unique_ptr<BrowserMainRunner> main_runner(BrowserMainRunner::Create()); 43 std::unique_ptr<BrowserMainRunner> main_runner(BrowserMainRunner::Create());
41 44
42 int exit_code = main_runner->Initialize(parameters); 45 int exit_code = main_runner->Initialize(parameters);
43 if (exit_code >= 0) 46 if (exit_code >= 0)
44 return exit_code; 47 return exit_code;
45 48
46 exit_code = main_runner->Run(); 49 exit_code = main_runner->Run();
47 50
48 main_runner->Shutdown(); 51 main_runner->Shutdown();
49 52
50 return exit_code; 53 return exit_code;
51 } 54 }
52 55
53 } // namespace content 56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698