OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/common/features.h" |
8 #include "content/public/app/content_main.h" | 9 #include "content/public/app/content_main.h" |
9 | 10 |
| 11 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
| 12 #include "base/command_line.h" |
| 13 #include "chrome/app/mash/mash_runner.h" |
| 14 #endif |
| 15 |
10 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
11 #include "base/debug/dump_without_crashing.h" | 17 #include "base/debug/dump_without_crashing.h" |
12 #include "base/win/win_util.h" | 18 #include "base/win/win_util.h" |
13 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
14 | 20 |
15 #define DLLEXPORT __declspec(dllexport) | 21 #define DLLEXPORT __declspec(dllexport) |
16 | 22 |
17 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 23 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
18 extern "C" { | 24 extern "C" { |
19 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 25 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 typedef void (__cdecl *DumpProcessFunction)(); | 63 typedef void (__cdecl *DumpProcessFunction)(); |
58 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( | 64 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( |
59 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName), | 65 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName), |
60 "DumpProcessWithoutCrash")); | 66 "DumpProcessWithoutCrash")); |
61 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); | 67 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); |
62 #else | 68 #else |
63 params.argc = argc; | 69 params.argc = argc; |
64 params.argv = argv; | 70 params.argv = argv; |
65 #endif | 71 #endif |
66 | 72 |
| 73 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
| 74 #if !defined(OS_WIN) |
| 75 base::CommandLine::Init(params.argc, params.argv); |
| 76 #endif |
| 77 const base::CommandLine& command_line = |
| 78 *base::CommandLine::ForCurrentProcess(); |
| 79 // TODO(sky): only do this for dev builds and if on canary channel. |
| 80 if (command_line.HasSwitch("mash")) |
| 81 return MashMain(); |
| 82 #endif |
| 83 |
67 int rv = content::ContentMain(params); | 84 int rv = content::ContentMain(params); |
68 | 85 |
69 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
70 base::win::SetShouldCrashOnProcessDetach(false); | 87 base::win::SetShouldCrashOnProcessDetach(false); |
71 #endif | 88 #endif |
72 | 89 |
73 return rv; | 90 return rv; |
74 } | 91 } |
OLD | NEW |