OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 5 #include <windows.h> |
6 #include <malloc.h> | 6 #include <malloc.h> |
7 #include <shellscalingapi.h> | 7 #include <shellscalingapi.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <tchar.h> | 9 #include <tchar.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "base/win/registry.h" | 23 #include "base/win/registry.h" |
24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
25 #include "chrome/app/main_dll_loader_win.h" | 25 #include "chrome/app/main_dll_loader_win.h" |
26 #include "chrome/browser/policy/policy_path_parser.h" | 26 #include "chrome/browser/policy/policy_path_parser.h" |
27 #include "chrome/browser/win/chrome_process_finder.h" | 27 #include "chrome/browser/win/chrome_process_finder.h" |
28 #include "chrome/common/chrome_constants.h" | |
29 #include "chrome/common/chrome_paths_internal.h" | 28 #include "chrome/common/chrome_paths_internal.h" |
30 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/install_static/install_details.h" | 30 #include "chrome/install_static/initialize_from_primary_module.h" |
32 #include "chrome_elf/chrome_elf_main.h" | 31 #include "chrome_elf/chrome_elf_main.h" |
33 #include "components/crash/content/app/crash_switches.h" | 32 #include "components/crash/content/app/crash_switches.h" |
34 #include "components/crash/content/app/crashpad.h" | 33 #include "components/crash/content/app/crashpad.h" |
35 #include "components/crash/content/app/run_as_crashpad_handler_win.h" | 34 #include "components/crash/content/app/run_as_crashpad_handler_win.h" |
36 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
37 #include "content/public/common/result_codes.h" | 36 #include "content/public/common/result_codes.h" |
38 | 37 |
39 namespace { | 38 namespace { |
40 | 39 |
41 // List of switches that it's safe to rendezvous early with. Fast start should | 40 // List of switches that it's safe to rendezvous early with. Fast start should |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // This is in chrome_elf. | 201 // This is in chrome_elf. |
203 extern "C" void BlockUntilHandlerStartedImpl(); | 202 extern "C" void BlockUntilHandlerStartedImpl(); |
204 #endif // SYZYASAN | 203 #endif // SYZYASAN |
205 | 204 |
206 #if !defined(WIN_CONSOLE_APP) | 205 #if !defined(WIN_CONSOLE_APP) |
207 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { | 206 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { |
208 #else | 207 #else |
209 int main() { | 208 int main() { |
210 HINSTANCE instance = GetModuleHandle(nullptr); | 209 HINSTANCE instance = GetModuleHandle(nullptr); |
211 #endif | 210 #endif |
212 install_static::InstallDetails::InitializeFromPrimaryModule( | 211 install_static::InitializeFromPrimaryModule(); |
213 chrome::kChromeElfDllName); | |
214 | 212 |
215 // Initialize the CommandLine singleton from the environment. | 213 // Initialize the CommandLine singleton from the environment. |
216 base::CommandLine::Init(0, nullptr); | 214 base::CommandLine::Init(0, nullptr); |
217 const base::CommandLine* command_line = | 215 const base::CommandLine* command_line = |
218 base::CommandLine::ForCurrentProcess(); | 216 base::CommandLine::ForCurrentProcess(); |
219 | 217 |
220 const std::string process_type = | 218 const std::string process_type = |
221 command_line->GetSwitchValueASCII(switches::kProcessType); | 219 command_line->GetSwitchValueASCII(switches::kProcessType); |
222 | 220 |
223 // Confirm that an explicit prefetch profile is used for all process types | 221 // Confirm that an explicit prefetch profile is used for all process types |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 RemoveAppCompatFlagsEntry(); | 254 RemoveAppCompatFlagsEntry(); |
257 | 255 |
258 // Load and launch the chrome dll. *Everything* happens inside. | 256 // Load and launch the chrome dll. *Everything* happens inside. |
259 VLOG(1) << "About to load main DLL."; | 257 VLOG(1) << "About to load main DLL."; |
260 MainDllLoader* loader = MakeMainDllLoader(); | 258 MainDllLoader* loader = MakeMainDllLoader(); |
261 int rc = loader->Launch(instance, exe_entry_point_ticks); | 259 int rc = loader->Launch(instance, exe_entry_point_ticks); |
262 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 260 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
263 delete loader; | 261 delete loader; |
264 return rc; | 262 return rc; |
265 } | 263 } |
OLD | NEW |