| 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 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 // Return if we changed anything so that we can restart. | 192 // Return if we changed anything so that we can restart. |
| 193 return tokens.size() != initial_size && result == ERROR_SUCCESS; | 193 return tokens.size() != initial_size && result == ERROR_SUCCESS; |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace | 199 } // namespace |
| 200 | 200 |
| 201 #if defined(SYZYASAN) |
| 202 // This is in chrome_elf. |
| 203 extern "C" void BlockUntilHandlerStartedImpl(); |
| 204 #endif // SYZYASAN |
| 205 |
| 201 #if !defined(WIN_CONSOLE_APP) | 206 #if !defined(WIN_CONSOLE_APP) |
| 202 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { | 207 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { |
| 203 #else | 208 #else |
| 204 int main() { | 209 int main() { |
| 205 HINSTANCE instance = GetModuleHandle(nullptr); | 210 HINSTANCE instance = GetModuleHandle(nullptr); |
| 206 #endif | 211 #endif |
| 207 install_static::InstallDetails::InitializeFromPrimaryModule( | 212 install_static::InstallDetails::InitializeFromPrimaryModule( |
| 208 chrome::kChromeElfDllName); | 213 chrome::kChromeElfDllName); |
| 209 | 214 |
| 210 // Initialize the CommandLine singleton from the environment. | 215 // Initialize the CommandLine singleton from the environment. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 225 if (process_type == crash_reporter::switches::kCrashpadHandler) { | 230 if (process_type == crash_reporter::switches::kCrashpadHandler) { |
| 226 return crash_reporter::RunAsCrashpadHandler( | 231 return crash_reporter::RunAsCrashpadHandler( |
| 227 *base::CommandLine::ForCurrentProcess()); | 232 *base::CommandLine::ForCurrentProcess()); |
| 228 } | 233 } |
| 229 | 234 |
| 230 const base::TimeTicks exe_entry_point_ticks = base::TimeTicks::Now(); | 235 const base::TimeTicks exe_entry_point_ticks = base::TimeTicks::Now(); |
| 231 | 236 |
| 232 // Signal Chrome Elf that Chrome has begun to start. | 237 // Signal Chrome Elf that Chrome has begun to start. |
| 233 SignalChromeElf(); | 238 SignalChromeElf(); |
| 234 | 239 |
| 240 #if defined(SYZYASAN) |
| 241 if (process_type.empty()) { |
| 242 // This is a temporary workaround for a race during startup with the |
| 243 // syzyasan_rtl.dll. See https://crbug.com/675710. |
| 244 BlockUntilHandlerStartedImpl(); |
| 245 } |
| 246 #endif // SYZYASAN |
| 247 |
| 235 // The exit manager is in charge of calling the dtors of singletons. | 248 // The exit manager is in charge of calling the dtors of singletons. |
| 236 base::AtExitManager exit_manager; | 249 base::AtExitManager exit_manager; |
| 237 | 250 |
| 238 EnableHighDPISupport(); | 251 EnableHighDPISupport(); |
| 239 | 252 |
| 240 if (AttemptFastNotify(*command_line)) | 253 if (AttemptFastNotify(*command_line)) |
| 241 return 0; | 254 return 0; |
| 242 | 255 |
| 243 RemoveAppCompatFlagsEntry(); | 256 RemoveAppCompatFlagsEntry(); |
| 244 | 257 |
| 245 // Load and launch the chrome dll. *Everything* happens inside. | 258 // Load and launch the chrome dll. *Everything* happens inside. |
| 246 VLOG(1) << "About to load main DLL."; | 259 VLOG(1) << "About to load main DLL."; |
| 247 MainDllLoader* loader = MakeMainDllLoader(); | 260 MainDllLoader* loader = MakeMainDllLoader(); |
| 248 int rc = loader->Launch(instance, exe_entry_point_ticks); | 261 int rc = loader->Launch(instance, exe_entry_point_ticks); |
| 249 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 262 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 250 delete loader; | 263 delete loader; |
| 251 return rc; | 264 return rc; |
| 252 } | 265 } |
| OLD | NEW |