
The service manager thread and (TODO) ServiceManager might be created before the full browser starts, and we want to reuse them when starting the full browser. Therefore, we add a pointer of BrowserStartupData in MainFunctionParams. Particularly, in this CL, ContentMainRunnerImpl creates and owns a BrowserStartupData object. It passes a pointer of the BrowserStartupData through the main function parameter to BrowserMainLoop. The BrowserStartupData interface was introduced in: https://crrev.com/c/1117471. Bug: 846846, 853308 Change-Id: Ie11063227a670cd8d72935131e854ee2b5c46e4e Reviewed-on: https://chromium-review.googlesource.com/1108178 Commit-Queue: Xi Han <hanxi@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Gabriel Charette <gab@chromium.org> Cr-Commit-Position: refs/heads/master@{#574054}
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "content/browser/browser_main.h"
|
|
|
|
#include <memory>
|
|
|
|
#include "base/trace_event/trace_event.h"
|
|
#include "content/browser/browser_main_runner_impl.h"
|
|
#include "content/common/content_constants_internal.h"
|
|
|
|
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) {
|
|
ScopedBrowserMainEvent scoped_browser_main_event;
|
|
|
|
base::trace_event::TraceLog::GetInstance()->set_process_name("Browser");
|
|
base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
|
|
kTraceEventBrowserProcessSortIndex);
|
|
|
|
std::unique_ptr<BrowserMainRunnerImpl> main_runner(
|
|
BrowserMainRunnerImpl::Create());
|
|
|
|
int exit_code = main_runner->Initialize(parameters);
|
|
if (exit_code >= 0)
|
|
return exit_code;
|
|
|
|
exit_code = main_runner->Run();
|
|
|
|
main_runner->Shutdown();
|
|
|
|
return exit_code;
|
|
}
|
|
|
|
} // namespace content
|