0
Files
src/content/browser/browser_main.cc
marshall@chromium.org f573ed6b41 Support sharing of ContentMain and BrowserMain code with embedded use cases (try ).
For the browser use case it is convenient to have a single ContentMain entry point function that handles all initialization, run and shutdown. For embedded use cases it is often necessary to integrate with existing application message loops where initialization and shutdown must be handled separately.

To support sharing of this code the following changes were required:

1. Refactor the ContentMain function to create a ContentMainRunner class containing separate initialization, run and shutdown functions.

2. Refactor the BrowserMain function and BrowserMainLoop class to create a BrowserMainRunner class containing separate initialization, run and shutdown functions.

3. Add a new BrowserMainParts::GetMainMessageLoop method. This is necessary to support creation of a custom MessageLoop implementation while sharing BrowserMainRunner initialization and shutdown code.

BUG=112507
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9375017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121454 0039d316-1c4b-4281-b951-d872f2087c98
2012-02-10 15:58:52 +00:00

29 lines
805 B
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 "base/debug/trace_event.h"
#include "content/public/browser/browser_main_runner.h"
// Main routine for running as the Browser process.
int BrowserMain(const content::MainFunctionParams& parameters) {
TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, "");
scoped_ptr<content::BrowserMainRunner> main_runner_(
content::BrowserMainRunner::Create());
int exit_code = main_runner_->Initialize(parameters);
if (exit_code >= 0)
return exit_code;
exit_code = main_runner_->Run();
main_runner_->Shutdown();
TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
return exit_code;
}