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 <stdint.h> |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/time/time.h" |
| 9 #include "chrome/app/chrome_main_delegate.h" |
8 #include "chrome/common/features.h" | 10 #include "chrome/common/features.h" |
9 #include "content/public/app/content_main.h" | 11 #include "content/public/app/content_main.h" |
10 | 12 |
11 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 13 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
12 #include "base/command_line.h" | 14 #include "base/command_line.h" |
13 #include "chrome/app/mash/mash_runner.h" | 15 #include "chrome/app/mash/mash_runner.h" |
14 #endif | 16 #endif |
15 | 17 |
16 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
17 #include "base/debug/dump_without_crashing.h" | 19 #include "base/debug/dump_without_crashing.h" |
18 #include "base/win/win_util.h" | 20 #include "base/win/win_util.h" |
19 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
20 | 22 |
21 #define DLLEXPORT __declspec(dllexport) | 23 #define DLLEXPORT __declspec(dllexport) |
22 | 24 |
23 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 25 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
24 extern "C" { | 26 extern "C" { |
25 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 27 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
26 sandbox::SandboxInterfaceInfo* sandbox_info); | 28 sandbox::SandboxInterfaceInfo* sandbox_info, |
| 29 int64_t exe_entry_point_ticks); |
27 } | 30 } |
28 #elif defined(OS_POSIX) | 31 #elif defined(OS_POSIX) |
29 extern "C" { | 32 extern "C" { |
30 __attribute__((visibility("default"))) | 33 __attribute__((visibility("default"))) |
31 int ChromeMain(int argc, const char** argv); | 34 int ChromeMain(int argc, const char** argv); |
32 } | 35 } |
33 #endif | 36 #endif |
34 | 37 |
35 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
36 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 39 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
37 sandbox::SandboxInterfaceInfo* sandbox_info) { | 40 sandbox::SandboxInterfaceInfo* sandbox_info, |
| 41 int64_t exe_entry_point_ticks) { |
38 #elif defined(OS_POSIX) | 42 #elif defined(OS_POSIX) |
39 int ChromeMain(int argc, const char** argv) { | 43 int ChromeMain(int argc, const char** argv) { |
| 44 int64_t exe_entry_point_ticks = 0; |
40 #endif | 45 #endif |
41 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) | 46 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) |
42 // VS2013 only checks the existence of FMA3 instructions, not the enabled-ness | 47 // 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 | 48 // 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 | 49 // 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. | 50 // instructions when running on CPUs that support FMA3, but OSs that don't. |
46 // See http://crbug.com/436603. | 51 // See http://crbug.com/436603. |
47 _set_FMA3_enable(0); | 52 _set_FMA3_enable(0); |
48 #endif // WIN && ARCH_CPU_X86_64 | 53 #endif // WIN && ARCH_CPU_X86_64 |
49 | 54 |
50 ChromeMainDelegate chrome_main_delegate; | 55 ChromeMainDelegate chrome_main_delegate( |
| 56 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); |
51 content::ContentMainParams params(&chrome_main_delegate); | 57 content::ContentMainParams params(&chrome_main_delegate); |
52 | 58 |
53 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
54 // The process should crash when going through abnormal termination. | 60 // The process should crash when going through abnormal termination. |
55 base::win::SetShouldCrashOnProcessDetach(true); | 61 base::win::SetShouldCrashOnProcessDetach(true); |
56 base::win::SetAbortBehaviorForCrashReporting(); | 62 base::win::SetAbortBehaviorForCrashReporting(); |
57 params.instance = instance; | 63 params.instance = instance; |
58 params.sandbox_info = sandbox_info; | 64 params.sandbox_info = sandbox_info; |
59 | 65 |
60 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function | 66 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function |
(...skipping 22 matching lines...) Expand all Loading... |
83 #endif | 89 #endif |
84 | 90 |
85 int rv = content::ContentMain(params); | 91 int rv = content::ContentMain(params); |
86 | 92 |
87 #if defined(OS_WIN) | 93 #if defined(OS_WIN) |
88 base::win::SetShouldCrashOnProcessDetach(false); | 94 base::win::SetShouldCrashOnProcessDetach(false); |
89 #endif | 95 #endif |
90 | 96 |
91 return rv; | 97 return rv; |
92 } | 98 } |
OLD | NEW |