Commit 8a820c82 authored by jam@chromium.org's avatar jam@chromium.org

Convert ContentMain to take a struct instead of parameters that vary depending...

Convert ContentMain to take a struct instead of parameters that vary depending on the platform. This helps reduce ifdef mess, and makes it easier to add extra optional parameters. In a followup cl, I'll move the ui_task parameter from MainFunctionParams to ContentMainParams.

BUG=350550
R=sky@chromium.org

Review URL: https://codereview.chromium.org/190853004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255866 0039d316-1c4b-4281-b951-d872f2087c98
parent a4afc43b
...@@ -11,19 +11,22 @@ ...@@ -11,19 +11,22 @@
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
sandbox::SandboxInterfaceInfo sandbox_info = {0}; #else
content::InitializeSandboxInfo(&sandbox_info); int main(int argc, const char** argv) {
#endif
apps::ShellMainDelegate delegate; apps::ShellMainDelegate delegate;
return content::ContentMain(instance, &sandbox_info, &delegate); content::ContentMainParams params(&delegate);
}
#if defined(OS_WIN)
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
params.instance = instance;
params.sandbox_info = &sandbox_info;
#else #else
params.argc = argc;
params.argv = argv;
#endif
int main(int argc, const char** argv) { return content::ContentMain(params);
apps::ShellMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate);
} }
#endif // OS_WIN
...@@ -12,14 +12,21 @@ ...@@ -12,14 +12,21 @@
#if defined(OS_WIN) #if defined(OS_WIN)
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
ash::shell::ShellMainDelegate delegate;
return content::ContentMain(instance, &sandbox_info, &delegate);
}
#else #else
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
#endif
ash::shell::ShellMainDelegate delegate; ash::shell::ShellMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate); content::ContentMainParams params(&delegate);
}
#if defined(OS_WIN)
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
params.instance = instance;
params.sandbox_info = &sandbox_info;
#else
params.argc = argc;
params.argv = argv;
#endif #endif
return content::ContentMain(params);
}
...@@ -26,16 +26,28 @@ int ChromeMain(int argc, const char** argv); ...@@ -26,16 +26,28 @@ int ChromeMain(int argc, const char** argv);
#if defined(OS_WIN) #if defined(OS_WIN)
DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance,
sandbox::SandboxInterfaceInfo* sandbox_info) { sandbox::SandboxInterfaceInfo* sandbox_info) {
#elif defined(OS_POSIX)
int ChromeMain(int argc, const char** argv) {
#endif
ChromeMainDelegate chrome_main_delegate;
content::ContentMainParams params(&chrome_main_delegate);
#if defined(OS_WIN)
// The process should crash when going through abnormal termination. // The process should crash when going through abnormal termination.
base::win::SetShouldCrashOnProcessDetach(true); base::win::SetShouldCrashOnProcessDetach(true);
base::win::SetAbortBehaviorForCrashReporting(); base::win::SetAbortBehaviorForCrashReporting();
ChromeMainDelegate chrome_main_delegate; params.instance = instance;
int rv = content::ContentMain(instance, sandbox_info, &chrome_main_delegate); params.sandbox_info = sandbox_info;
#else
params.argc = argc;
params.argv = argv;
#endif
int rv = content::ContentMain(params);
#if defined(OS_WIN)
base::win::SetShouldCrashOnProcessDetach(false); base::win::SetShouldCrashOnProcessDetach(false);
return rv;
#elif defined(OS_POSIX)
int ChromeMain(int argc, const char** argv) {
ChromeMainDelegate chrome_main_delegate;
return content::ContentMain(argc, argv, &chrome_main_delegate);
#endif #endif
return rv;
} }
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include "jni/ContentMain_jni.h" #include "jni/ContentMain_jni.h"
using base::LazyInstance; using base::LazyInstance;
using content::ContentMainRunner;
using content::ContentMainDelegate; namespace content {
namespace { namespace {
LazyInstance<scoped_ptr<ContentMainRunner> > g_content_runner = LazyInstance<scoped_ptr<ContentMainRunner> > g_content_runner =
...@@ -28,8 +28,6 @@ LazyInstance<scoped_ptr<ContentMainDelegate> > g_content_main_delegate = ...@@ -28,8 +28,6 @@ LazyInstance<scoped_ptr<ContentMainDelegate> > g_content_main_delegate =
} // namespace } // namespace
namespace content {
static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) { static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) {
base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context);
base::android::InitApplicationContext(env, scoped_context); base::android::InitApplicationContext(env, scoped_context);
...@@ -43,9 +41,9 @@ static jint Start(JNIEnv* env, jclass clazz) { ...@@ -43,9 +41,9 @@ static jint Start(JNIEnv* env, jclass clazz) {
// request then we have to call this a second time to finish starting the // request then we have to call this a second time to finish starting the
// browser synchronously. // browser synchronously.
if (!g_content_runner.Get().get()) { if (!g_content_runner.Get().get()) {
ContentMainParams params(g_content_main_delegate.Get().get());
g_content_runner.Get().reset(ContentMainRunner::Create()); g_content_runner.Get().reset(ContentMainRunner::Create());
g_content_runner.Get()->Initialize( g_content_runner.Get()->Initialize(params);
0, NULL, g_content_main_delegate.Get().get());
} }
return g_content_runner.Get()->Run(); return g_content_runner.Get()->Run();
} }
......
...@@ -9,26 +9,10 @@ ...@@ -9,26 +9,10 @@
namespace content { namespace content {
#if defined(OS_WIN) int ContentMain(const ContentMainParams& params) {
int ContentMain(HINSTANCE instance,
sandbox::SandboxInterfaceInfo* sandbox_info,
ContentMainDelegate* delegate) {
#else
int ContentMain(int argc,
const char** argv,
ContentMainDelegate* delegate) {
#endif // OS_WIN
scoped_ptr<ContentMainRunner> main_runner(ContentMainRunner::Create()); scoped_ptr<ContentMainRunner> main_runner(ContentMainRunner::Create());
int exit_code; int exit_code = main_runner->Initialize(params);
#if defined(OS_WIN)
exit_code = main_runner->Initialize(instance, sandbox_info, delegate);
#else
exit_code = main_runner->Initialize(argc, argv, delegate);
#endif // OS_WIN
if (exit_code >= 0) if (exit_code >= 0)
return exit_code; return exit_code;
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "content/common/set_process_title.h" #include "content/common/set_process_title.h"
#include "content/common/url_schemes.h" #include "content/common/url_schemes.h"
#include "content/gpu/in_process_gpu_thread.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/content_main_delegate.h"
#include "content/public/app/startup_helper_win.h" #include "content/public/app/startup_helper_win.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
...@@ -524,22 +525,13 @@ class ContentMainRunnerImpl : public ContentMainRunner { ...@@ -524,22 +525,13 @@ class ContentMainRunnerImpl : public ContentMainRunner {
} }
#endif #endif
#if defined(OS_WIN) virtual int Initialize(const ContentMainParams& params) OVERRIDE {
virtual int Initialize(HINSTANCE instance, #if defined(OS_WIN)
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(); 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 #else // !OS_WIN
virtual int Initialize(int argc,
const char** argv,
ContentMainDelegate* delegate) OVERRIDE {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// See note at the initialization of ExitManager, below; basically, // See note at the initialization of ExitManager, below; basically,
...@@ -609,7 +601,7 @@ class ContentMainRunnerImpl : public ContentMainRunner { ...@@ -609,7 +601,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
#endif // !OS_WIN #endif // !OS_WIN
is_initialized_ = true; is_initialized_ = true;
delegate_ = delegate; delegate_ = params.delegate;
base::EnableTerminationOnHeapCorruption(); base::EnableTerminationOnHeapCorruption();
base::EnableTerminationOnOutOfMemory(); base::EnableTerminationOnOutOfMemory();
...@@ -634,11 +626,25 @@ class ContentMainRunnerImpl : public ContentMainRunner { ...@@ -634,11 +626,25 @@ class ContentMainRunnerImpl : public ContentMainRunner {
// On Android, the command line is initialized when library is loaded and // On Android, the command line is initialized when library is loaded and
// we have already started our TRACE_EVENT0. // we have already started our TRACE_EVENT0.
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
// argc/argv are ignored on Windows and Android; see command_line.h for
// details.
int argc = 0;
const char** argv = NULL;
#if !defined(OS_WIN)
argc = params.argc;
argv = params.argv;
#endif
CommandLine::Init(argc, argv); CommandLine::Init(argc, argv);
#if !defined(OS_IOS)
SetProcessTitleFromCommandLine(argv);
#endif
#endif // !OS_ANDROID #endif // !OS_ANDROID
int exit_code; int exit_code;
if (delegate && delegate->BasicStartupComplete(&exit_code)) if (delegate_ && delegate_->BasicStartupComplete(&exit_code))
return exit_code; return exit_code;
completed_basic_startup_ = true; completed_basic_startup_ = true;
...@@ -680,13 +686,13 @@ class ContentMainRunnerImpl : public ContentMainRunner { ...@@ -680,13 +686,13 @@ class ContentMainRunnerImpl : public ContentMainRunner {
// It's important not to allocate the ports for processes which don't // It's important not to allocate the ports for processes which don't
// register with the power monitor - see crbug.com/88867. // register with the power monitor - see crbug.com/88867.
if (process_type.empty() || if (process_type.empty() ||
(delegate && (delegate_ &&
delegate->ProcessRegistersWithSystemProcess(process_type))) { delegate_->ProcessRegistersWithSystemProcess(process_type))) {
base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); base::PowerMonitorDeviceSource::AllocateSystemIOPorts();
} }
if (!process_type.empty() && if (!process_type.empty() &&
(!delegate || delegate->ShouldSendMachPort(process_type))) { (!delegate_ || delegate_->ShouldSendMachPort(process_type))) {
MachBroker::ChildSendTaskPortToParent(); MachBroker::ChildSendTaskPortToParent();
} }
#elif defined(OS_WIN) #elif defined(OS_WIN)
...@@ -729,18 +735,18 @@ class ContentMainRunnerImpl : public ContentMainRunner { ...@@ -729,18 +735,18 @@ class ContentMainRunnerImpl : public ContentMainRunner {
InitializeStatsTable(command_line); InitializeStatsTable(command_line);
if (delegate) if (delegate_)
delegate->PreSandboxStartup(); delegate_->PreSandboxStartup();
if (!process_type.empty()) if (!process_type.empty())
CommonSubprocessInit(process_type); CommonSubprocessInit(process_type);
#if defined(OS_WIN) #if defined(OS_WIN)
CHECK(InitializeSandbox(sandbox_info)); CHECK(InitializeSandbox(params.sandbox_info));
#elif defined(OS_MACOSX) && !defined(OS_IOS) #elif defined(OS_MACOSX) && !defined(OS_IOS)
if (process_type == switches::kRendererProcess || if (process_type == switches::kRendererProcess ||
process_type == switches::kPpapiPluginProcess || 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 // On OS X the renderer sandbox needs to be initialized later in the
// startup sequence in RendererMainPlatformDelegate::EnableSandbox(). // startup sequence in RendererMainPlatformDelegate::EnableSandbox().
} else { } else {
...@@ -748,12 +754,8 @@ class ContentMainRunnerImpl : public ContentMainRunner { ...@@ -748,12 +754,8 @@ class ContentMainRunnerImpl : public ContentMainRunner {
} }
#endif #endif
if (delegate) if (delegate_)
delegate->SandboxInitialized(process_type); delegate_->SandboxInitialized(process_type);
#if defined(OS_POSIX) && !defined(OS_IOS)
SetProcessTitleFromCommandLine(argv);
#endif
// Return -1 to indicate no early termination. // Return -1 to indicate no early termination.
return -1; return -1;
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ #ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_H_
#define CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ #define CONTENT_PUBLIC_APP_CONTENT_MAIN_H_
#include <stddef.h>
#include "build/build_config.h" #include "build/build_config.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
...@@ -17,21 +19,36 @@ struct SandboxInterfaceInfo; ...@@ -17,21 +19,36 @@ struct SandboxInterfaceInfo;
} }
namespace content { namespace content {
class ContentMainDelegate; class ContentMainDelegate;
// ContentMain should be called from the embedder's main() function to do the struct ContentMainParams {
// initial setup for every process. The embedder has a chance to customize explicit ContentMainParams(ContentMainDelegate* delegate)
// startup using the ContentMainDelegate interface. The embedder can also pass : delegate(delegate)
// in NULL for |delegate| if they don't want to override default startup.
#if defined(OS_WIN) #if defined(OS_WIN)
, instance(NULL),
sandbox_info(NULL)
#elif !defined(OS_ANDROID)
, argc(0),
argv(NULL)
#endif
{
}
// |sandbox_info| should be initialized using InitializeSandboxInfo from ContentMainDelegate* delegate;
// content_main_win.h
CONTENT_EXPORT int ContentMain(HINSTANCE instance, #if defined(OS_WIN)
sandbox::SandboxInterfaceInfo* sandbox_info, HINSTANCE instance;
ContentMainDelegate* delegate);
#elif defined(OS_ANDROID) // |sandbox_info| should be initialized using InitializeSandboxInfo from
// content_main_win.h
sandbox::SandboxInterfaceInfo* sandbox_info;
#elif !defined(OS_ANDROID)
int argc;
const char** argv;
#endif
};
#if defined(OS_ANDROID)
// In the Android, the content main starts from ContentMain.java, This function // In the Android, the content main starts from ContentMain.java, This function
// provides a way to set the |delegate| as ContentMainDelegate for // provides a way to set the |delegate| as ContentMainDelegate for
// ContentMainRunner. // ContentMainRunner.
...@@ -39,10 +56,12 @@ CONTENT_EXPORT int ContentMain(HINSTANCE instance, ...@@ -39,10 +56,12 @@ CONTENT_EXPORT int ContentMain(HINSTANCE instance,
// The ownership of |delegate| is transferred. // The ownership of |delegate| is transferred.
CONTENT_EXPORT void SetContentMainDelegate(ContentMainDelegate* delegate); CONTENT_EXPORT void SetContentMainDelegate(ContentMainDelegate* delegate);
#else #else
CONTENT_EXPORT int ContentMain(int argc, // ContentMain should be called from the embedder's main() function to do the
const char** argv, // initial setup for every process. The embedder has a chance to customize
ContentMainDelegate* delegate); // startup using the ContentMainDelegate interface. The embedder can also pass
#endif // defined(OS_WIN) // in NULL for |delegate| if they don't want to override default startup.
CONTENT_EXPORT int ContentMain(const ContentMainParams& params);
#endif
} // namespace content } // namespace content
......
...@@ -5,21 +5,8 @@ ...@@ -5,21 +5,8 @@
#ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_ #ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_
#define CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_ #define CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_
#include <string>
#include "build/build_config.h"
#if defined(OS_WIN)
#include <windows.h>
#endif
namespace sandbox {
struct SandboxInterfaceInfo;
}
namespace content { namespace content {
struct ContentMainParams;
class ContentMainDelegate;
// This class is responsible for content initialization, running and shutdown. // This class is responsible for content initialization, running and shutdown.
class ContentMainRunner { class ContentMainRunner {
...@@ -30,19 +17,7 @@ class ContentMainRunner { ...@@ -30,19 +17,7 @@ class ContentMainRunner {
static ContentMainRunner* Create(); static ContentMainRunner* Create();
// Initialize all necessary content state. // Initialize all necessary content state.
#if defined(OS_WIN) virtual int Initialize(const ContentMainParams& params) = 0;
// The |sandbox_info| and |delegate| objects must outlive this class.
// |sandbox_info| should be initialized using InitializeSandboxInfo from
// content_main_win.h.
virtual int Initialize(HINSTANCE instance,
sandbox::SandboxInterfaceInfo* sandbox_info,
ContentMainDelegate* delegate) = 0;
#else
// The |delegate| object must outlive this class.
virtual int Initialize(int argc,
const char** argv,
ContentMainDelegate* delegate) = 0;
#endif
// Perform the default run logic. // Perform the default run logic.
virtual int Run() = 0; virtual int Run() = 0;
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#ifndef CONTENT_PUBLIC_COMMON_MAIN_FUNCTION_PARAMS_H_ #ifndef CONTENT_PUBLIC_COMMON_MAIN_FUNCTION_PARAMS_H_
#define CONTENT_PUBLIC_COMMON_MAIN_FUNCTION_PARAMS_H_ #define CONTENT_PUBLIC_COMMON_MAIN_FUNCTION_PARAMS_H_
#include "base/command_line.h"
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/command_line.h"
#if defined(OS_WIN) #if defined(OS_WIN)
namespace sandbox { namespace sandbox {
...@@ -34,13 +34,17 @@ struct MainFunctionParams { ...@@ -34,13 +34,17 @@ struct MainFunctionParams {
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
autorelease_pool(NULL), autorelease_pool(NULL),
#endif #endif
ui_task(NULL) {} ui_task(NULL) {
}
const CommandLine& command_line; const CommandLine& command_line;
#if defined(OS_WIN) #if defined(OS_WIN)
sandbox::SandboxInterfaceInfo* sandbox_info; sandbox::SandboxInterfaceInfo* sandbox_info;
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
base::mac::ScopedNSAutoreleasePool* autorelease_pool; base::mac::ScopedNSAutoreleasePool* autorelease_pool;
#endif #endif
// Used by InProcessBrowserTest. If non-null BrowserMain schedules this // Used by InProcessBrowserTest. If non-null BrowserMain schedules this
// task to run on the MessageLoop and BrowserInit is not invoked. // task to run on the MessageLoop and BrowserInit is not invoked.
base::Closure* ui_task; base::Closure* ui_task;
......
...@@ -427,35 +427,34 @@ const char kSingleProcessTestsFlag[] = "single_process"; ...@@ -427,35 +427,34 @@ const char kSingleProcessTestsFlag[] = "single_process";
TestLauncherDelegate::~TestLauncherDelegate() { TestLauncherDelegate::~TestLauncherDelegate() {
} }
bool ShouldRunContentMain() {
#if defined(OS_WIN) || defined(OS_LINUX) #if defined(OS_WIN) || defined(OS_LINUX)
bool ShouldRunContentMain() {
CommandLine* command_line = CommandLine::ForCurrentProcess(); CommandLine* command_line = CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kProcessType) || return command_line->HasSwitch(switches::kProcessType) ||
command_line->HasSwitch(kLaunchAsBrowser); command_line->HasSwitch(kLaunchAsBrowser);
#else
return false; return false;
#endif // defined(OS_WIN) || defined(OS_LINUX)
} }
int RunContentMain(int argc, char** argv, int RunContentMain(int argc, char** argv,
TestLauncherDelegate* launcher_delegate) { TestLauncherDelegate* launcher_delegate) {
scoped_ptr<ContentMainDelegate> chrome_main_delegate(
launcher_delegate->CreateContentMainDelegate());
ContentMainParams params(chrome_main_delegate.get());
#if defined(OS_WIN) #if defined(OS_WIN)
sandbox::SandboxInterfaceInfo sandbox_info = {0}; sandbox::SandboxInterfaceInfo sandbox_info = {0};
InitializeSandboxInfo(&sandbox_info); InitializeSandboxInfo(&sandbox_info);
scoped_ptr<ContentMainDelegate> chrome_main_delegate(
launcher_delegate->CreateContentMainDelegate()); params.instance = GetModuleHandle(NULL);
return ContentMain(GetModuleHandle(NULL), params.sandbox_info = &sandbox_info;
&sandbox_info,
chrome_main_delegate.get());
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
scoped_ptr<ContentMainDelegate> chrome_main_delegate( params.argc = argc;
launcher_delegate->CreateContentMainDelegate()); params.argv = const_cast<const char**>(argv);
return ContentMain(argc, const_cast<const char**>(argv),
chrome_main_delegate.get());
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
NOTREACHED();
return 0; return ContentMain(params);
} }
#endif
int LaunchTests(TestLauncherDelegate* launcher_delegate, int LaunchTests(TestLauncherDelegate* launcher_delegate,
int default_jobs, int default_jobs,
...@@ -487,8 +486,10 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate, ...@@ -487,8 +486,10 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate,
return launcher_delegate->RunTestSuite(argc, argv); return launcher_delegate->RunTestSuite(argc, argv);
} }
#if defined(OS_WIN) || defined(OS_LINUX)
if (ShouldRunContentMain()) if (ShouldRunContentMain())
return RunContentMain(argc, argv, launcher_delegate); return RunContentMain(argc, argv, launcher_delegate);
#endif
base::AtExitManager at_exit; base::AtExitManager at_exit;
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
int ContentMain(int argc, int ContentMain(int argc,
const char** argv) { const char** argv) {
content::ShellMainDelegate delegate; content::ShellMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate); content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = argv;
return content::ContentMain(params);
} }
#endif // OS_MACOSX #endif // OS_MACOSX
...@@ -20,7 +20,11 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { ...@@ -20,7 +20,11 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
sandbox::SandboxInterfaceInfo sandbox_info = {0}; sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info); content::InitializeSandboxInfo(&sandbox_info);
content::ShellMainDelegate delegate; content::ShellMainDelegate delegate;
return content::ContentMain(instance, &sandbox_info, &delegate);
content::ContentMainParams params(&delegate);
params.instance = instance;
params.sandbox_info = &sandbox_info;
return content::ContentMain(params);
} }
#else #else
...@@ -32,7 +36,10 @@ int main(int argc, const char** argv) { ...@@ -32,7 +36,10 @@ int main(int argc, const char** argv) {
return ::ContentMain(argc, argv); return ::ContentMain(argc, argv);
#else #else
content::ShellMainDelegate delegate; content::ShellMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate); content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = argv;
return content::ContentMain(params);
#endif // OS_MACOSX #endif // OS_MACOSX
} }
......
...@@ -12,14 +12,21 @@ ...@@ -12,14 +12,21 @@
#if defined(OS_WIN) #if defined(OS_WIN)
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
views::examples::ExamplesMainDelegate delegate;
return content::ContentMain(instance, &sandbox_info, &delegate);
}
#else #else
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
#endif
views::examples::ExamplesMainDelegate delegate; views::examples::ExamplesMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate); content::ContentMainParams params(&delegate);
}
#if defined(OS_WIN)
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
params.instance = instance;
params.sandbox_info = &sandbox_info;
#else
params.argc = argc;
params.argv = argv;
#endif #endif
return content::ContentMain(params);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment