| OLD | NEW |
| 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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "content/common/content_constants_internal.h" | 8 #include "content/common/content_constants_internal.h" |
| 9 #include "content/public/browser/browser_main_runner.h" | 9 #include "content/public/browser/browser_main_runner.h" |
| 10 #include "content/public/common/startup_task_runner.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 // Main routine for running as the Browser process. | 14 // Main routine for running as the Browser process. |
| 14 int BrowserMain(const MainFunctionParams& parameters) { | 15 int BrowserMain(const MainFunctionParams& parameters) { |
| 15 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); | 16 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); |
| 16 base::debug::TraceLog::GetInstance()->SetProcessName("Browser"); | 17 base::debug::TraceLog::GetInstance()->SetProcessName("Browser"); |
| 17 base::debug::TraceLog::GetInstance()->SetProcessSortIndex( | 18 base::debug::TraceLog::GetInstance()->SetProcessSortIndex( |
| 18 kTraceEventBrowserProcessSortIndex); | 19 kTraceEventBrowserProcessSortIndex); |
| 19 | 20 |
| 20 scoped_ptr<BrowserMainRunner> main_runner(BrowserMainRunner::Create()); | 21 scoped_ptr<BrowserMainRunner> main_runner(BrowserMainRunner::Create()); |
| 21 | 22 |
| 22 int exit_code = main_runner->Initialize(parameters); | 23 scoped_refptr<content::StartupTaskRunner> startup_task_runner = |
| 24 make_scoped_refptr(new content::StartupTaskRunner( |
| 25 content::StartupTaskRunner::IMMEDIATE, NULL)); |
| 26 |
| 27 int exit_code = main_runner->Initialize(parameters, startup_task_runner); |
| 23 if (exit_code >= 0) | 28 if (exit_code >= 0) |
| 24 return exit_code; | 29 return exit_code; |
| 25 | 30 |
| 26 exit_code = main_runner->Run(); | 31 exit_code = main_runner->Run(); |
| 27 | 32 |
| 28 main_runner->Shutdown(); | 33 main_runner->Shutdown(); |
| 29 | 34 |
| 30 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 35 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
| 31 | 36 |
| 32 return exit_code; | 37 return exit_code; |
| 33 } | 38 } |
| 34 | 39 |
| 35 } // namespace content | 40 } // namespace content |
| OLD | NEW |