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 "chrome/common/features.h" |
9 #include "content/public/app/content_main.h" | 9 #include "content/public/app/content_main.h" |
10 | 10 |
11 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 11 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "chrome/app/mash/mash_runner.h" | 13 #include "chrome/app/mash/mash_runner.h" |
14 #endif | 14 #endif |
15 | 15 |
16 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
17 #include "base/debug/dump_without_crashing.h" | 17 #include "base/debug/dump_without_crashing.h" |
18 #include "base/win/win_util.h" | 18 #include "base/win/win_util.h" |
19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
20 | 20 |
21 #define DLLEXPORT __declspec(dllexport) | 21 #define DLLEXPORT __declspec(dllexport) |
22 | 22 |
23 // 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. |
24 extern "C" { | 24 extern "C" { |
25 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 25 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
26 sandbox::SandboxInterfaceInfo* sandbox_info); | 26 sandbox::SandboxInterfaceInfo* sandbox_info, |
27 int64_t exe_entry_point_ticks); | |
fdoray
2016/09/19 17:03:28
#include <stdint.h>?
fdoray
2016/09/19 17:03:28
Could it be base::TimeTicks instead of int64_t? Or
grt (UTC plus 2)
2016/09/19 19:52:46
Done.
grt (UTC plus 2)
2016/09/19 19:52:46
It's safest to stick to primitive types when cross
| |
27 } | 28 } |
28 #elif defined(OS_POSIX) | 29 #elif defined(OS_POSIX) |
29 extern "C" { | 30 extern "C" { |
30 __attribute__((visibility("default"))) | 31 __attribute__((visibility("default"))) |
31 int ChromeMain(int argc, const char** argv); | 32 int ChromeMain(int argc, const char** argv); |
32 } | 33 } |
33 #endif | 34 #endif |
34 | 35 |
35 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
36 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 37 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
37 sandbox::SandboxInterfaceInfo* sandbox_info) { | 38 sandbox::SandboxInterfaceInfo* sandbox_info, |
39 int64_t exe_entry_point_ticks) { | |
38 #elif defined(OS_POSIX) | 40 #elif defined(OS_POSIX) |
39 int ChromeMain(int argc, const char** argv) { | 41 int ChromeMain(int argc, const char** argv) { |
42 int64_t exe_entry_point_ticks = 0; | |
40 #endif | 43 #endif |
41 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) | 44 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) |
42 // VS2013 only checks the existence of FMA3 instructions, not the enabled-ness | 45 // VS2013 only checks the existence of FMA3 instructions, not the enabled-ness |
43 // of them at the OS level (this is fixed in VS2015). We force off usage of | 46 // of them at the OS level (this is fixed in VS2015). We force off usage of |
44 // FMA3 instructions in the CRT to avoid using that path and hitting illegal | 47 // FMA3 instructions in the CRT to avoid using that path and hitting illegal |
45 // instructions when running on CPUs that support FMA3, but OSs that don't. | 48 // instructions when running on CPUs that support FMA3, but OSs that don't. |
46 // See http://crbug.com/436603. | 49 // See http://crbug.com/436603. |
47 _set_FMA3_enable(0); | 50 _set_FMA3_enable(0); |
48 #endif // WIN && ARCH_CPU_X86_64 | 51 #endif // WIN && ARCH_CPU_X86_64 |
49 | 52 |
50 ChromeMainDelegate chrome_main_delegate; | 53 ChromeMainDelegate chrome_main_delegate(exe_entry_point_ticks); |
51 content::ContentMainParams params(&chrome_main_delegate); | 54 content::ContentMainParams params(&chrome_main_delegate); |
52 | 55 |
53 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
54 // The process should crash when going through abnormal termination. | 57 // The process should crash when going through abnormal termination. |
55 base::win::SetShouldCrashOnProcessDetach(true); | 58 base::win::SetShouldCrashOnProcessDetach(true); |
56 base::win::SetAbortBehaviorForCrashReporting(); | 59 base::win::SetAbortBehaviorForCrashReporting(); |
57 params.instance = instance; | 60 params.instance = instance; |
58 params.sandbox_info = sandbox_info; | 61 params.sandbox_info = sandbox_info; |
59 | 62 |
60 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function | 63 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function |
(...skipping 22 matching lines...) Expand all Loading... | |
83 #endif | 86 #endif |
84 | 87 |
85 int rv = content::ContentMain(params); | 88 int rv = content::ContentMain(params); |
86 | 89 |
87 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
88 base::win::SetShouldCrashOnProcessDetach(false); | 91 base::win::SetShouldCrashOnProcessDetach(false); |
89 #endif | 92 #endif |
90 | 93 |
91 return rv; | 94 return rv; |
92 } | 95 } |
OLD | NEW |