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

Unified Diff: content/app/content_main_runner.cc

Issue 190853004: Convert ContentMain to take a struct instead of parameters that vary depending on the platform. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/app/content_main_runner.cc
===================================================================
--- content/app/content_main_runner.cc (revision 255697)
+++ content/app/content_main_runner.cc (working copy)
@@ -30,6 +30,7 @@
#include "content/common/set_process_title.h"
#include "content/common/url_schemes.h"
#include "content/gpu/in_process_gpu_thread.h"
+#include "content/public/app/content_main.h"
#include "content/public/app/content_main_delegate.h"
#include "content/public/app/startup_helper_win.h"
#include "content/public/browser/content_browser_client.h"
@@ -533,22 +534,22 @@
}
#endif
+ virtual int Initialize(ContentMainParams* params) OVERRIDE {
#if defined(OS_WIN)
- virtual int Initialize(HINSTANCE instance,
- sandbox::SandboxInterfaceInfo* sandbox_info,
- ContentMainDelegate* delegate) OVERRIDE {
// argc/argv are ignored on Windows; see command_line.h for details.
int argc = 0;
char** argv = NULL;
RegisterInvalidParamHandler();
- _Module.Init(NULL, static_cast<HINSTANCE>(instance));
+ _Module.Init(NULL, static_cast<HINSTANCE>(params->instance));
- sandbox_info_ = *sandbox_info;
+ sandbox_info_ = *params->sandbox_info;
#else // !OS_WIN
virtual int Initialize(int argc,
const char** argv,
ContentMainDelegate* delegate) OVERRIDE {
+ int argc = params->argc;
+ char** argv = params->argv;
#if defined(OS_ANDROID)
// See note at the initialization of ExitManager, below; basically,
@@ -618,7 +619,7 @@
#endif // !OS_WIN
is_initialized_ = true;
- delegate_ = delegate;
+ delegate_ = params->delegate;
base::EnableTerminationOnHeapCorruption();
base::EnableTerminationOnOutOfMemory();
@@ -647,7 +648,7 @@
#endif // !OS_ANDROID
int exit_code;
- if (delegate && delegate->BasicStartupComplete(&exit_code))
+ if (delegate_ && delegate_->BasicStartupComplete(&exit_code))
return exit_code;
completed_basic_startup_ = true;
@@ -689,13 +690,13 @@
// It's important not to allocate the ports for processes which don't
// register with the power monitor - see crbug.com/88867.
if (process_type.empty() ||
- (delegate &&
- delegate->ProcessRegistersWithSystemProcess(process_type))) {
+ (delegate_ &&
+ delegate_->ProcessRegistersWithSystemProcess(process_type))) {
base::PowerMonitorDeviceSource::AllocateSystemIOPorts();
}
if (!process_type.empty() &&
- (!delegate || delegate->ShouldSendMachPort(process_type))) {
+ (!delegate_ || delegate_->ShouldSendMachPort(process_type))) {
MachBroker::ChildSendTaskPortToParent();
}
#elif defined(OS_WIN)
@@ -738,8 +739,8 @@
InitializeStatsTable(command_line);
- if (delegate)
- delegate->PreSandboxStartup();
+ if (delegate_)
+ delegate_->PreSandboxStartup();
// Set any custom user agent passed on the command line now so the string
// doesn't change between calls to webkit_glue::GetUserAgent(), otherwise it
@@ -753,11 +754,11 @@
CommonSubprocessInit(process_type);
#if defined(OS_WIN)
- CHECK(InitializeSandbox(sandbox_info));
+ CHECK(InitializeSandbox(params->sandbox_info));
#elif defined(OS_MACOSX) && !defined(OS_IOS)
if (process_type == switches::kRendererProcess ||
process_type == switches::kPpapiPluginProcess ||
- (delegate && delegate->DelaySandboxInitialization(process_type))) {
+ (delegate_ && delegate_->DelaySandboxInitialization(process_type))) {
// On OS X the renderer sandbox needs to be initialized later in the
// startup sequence in RendererMainPlatformDelegate::EnableSandbox().
} else {
@@ -765,8 +766,8 @@
}
#endif
- if (delegate)
- delegate->SandboxInitialized(process_type);
+ if (delegate_)
+ delegate_->SandboxInitialized(process_type);
#if defined(OS_POSIX) && !defined(OS_IOS)
SetProcessTitleFromCommandLine(argv);

Powered by Google App Engine
This is Rietveld 408576698