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 3 // found in the LICENSE file. 4 5 #include "chrome/app/chrome_main_delegate.h" 6 7 #include "content/public/app/content_main.h" 8 9 #if defined(OS_WIN) 10 #include "base/win/win_util.h" 11 12 #define DLLEXPORT __declspec(dllexport) 13 14 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 15 extern "C" { 16 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, 17 sandbox::SandboxInterfaceInfo* sandbox_info); 18 } 19 #elif defined(OS_POSIX) 20 extern "C" { 21 __attribute__((visibility("default"))) 22 int ChromeMain(int argc, const char** argv); 23 } 24 #endif 25 26 #if defined(OS_WIN) ChromeMain(HINSTANCE instance,sandbox::SandboxInterfaceInfo * sandbox_info)27DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, 28 sandbox::SandboxInterfaceInfo* sandbox_info) { 29 // The process should crash when going through abnormal termination. 30 base::win::SetShouldCrashOnProcessDetach(true); 31 base::win::SetAbortBehaviorForCrashReporting(); 32 ChromeMainDelegate chrome_main_delegate; 33 int rv = content::ContentMain(instance, sandbox_info, &chrome_main_delegate); 34 base::win::SetShouldCrashOnProcessDetach(false); 35 return rv; 36 #elif defined(OS_POSIX) 37 int ChromeMain(int argc, const char** argv) { 38 ChromeMainDelegate chrome_main_delegate; 39 return content::ContentMain(argc, argv, &chrome_main_delegate); 40 #endif 41 } 42