| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/policy/policy_path_parser.h" | 27 #include "chrome/browser/policy/policy_path_parser.h" |
| 28 #include "chrome/browser/win/chrome_process_finder.h" | 28 #include "chrome/browser/win/chrome_process_finder.h" |
| 29 #include "chrome/common/chrome_paths_internal.h" | 29 #include "chrome/common/chrome_paths_internal.h" |
| 30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/installer/util/browser_distribution.h" | 31 #include "chrome/installer/util/browser_distribution.h" |
| 32 #include "chrome_elf/chrome_elf_main.h" | 32 #include "chrome_elf/chrome_elf_main.h" |
| 33 #include "components/crash/content/app/crash_switches.h" | 33 #include "components/crash/content/app/crash_switches.h" |
| 34 #include "components/crash/content/app/crashpad.h" | 34 #include "components/crash/content/app/crashpad.h" |
| 35 #include "components/crash/content/app/run_as_crashpad_handler_win.h" | 35 #include "components/crash/content/app/run_as_crashpad_handler_win.h" |
| 36 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 36 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
| 37 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" | |
| 38 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 39 #include "content/public/common/result_codes.h" | 38 #include "content/public/common/result_codes.h" |
| 40 | 39 |
| 41 namespace { | 40 namespace { |
| 42 | 41 |
| 43 // List of switches that it's safe to rendezvous early with. Fast start should | 42 // List of switches that it's safe to rendezvous early with. Fast start should |
| 44 // not be done if a command line contains a switch not in this set. | 43 // not be done if a command line contains a switch not in this set. |
| 45 // Note this is currently stored as a list of two because it's probably faster | 44 // Note this is currently stored as a list of two because it's probably faster |
| 46 // to iterate over this small array than building a map for constant time | 45 // to iterate over this small array than building a map for constant time |
| 47 // lookups. | 46 // lookups. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 HINSTANCE instance = GetModuleHandle(nullptr); | 206 HINSTANCE instance = GetModuleHandle(nullptr); |
| 208 #endif | 207 #endif |
| 209 // Initialize the CommandLine singleton from the environment. | 208 // Initialize the CommandLine singleton from the environment. |
| 210 base::CommandLine::Init(0, nullptr); | 209 base::CommandLine::Init(0, nullptr); |
| 211 const base::CommandLine* command_line = | 210 const base::CommandLine* command_line = |
| 212 base::CommandLine::ForCurrentProcess(); | 211 base::CommandLine::ForCurrentProcess(); |
| 213 | 212 |
| 214 const std::string process_type = | 213 const std::string process_type = |
| 215 command_line->GetSwitchValueASCII(switches::kProcessType); | 214 command_line->GetSwitchValueASCII(switches::kProcessType); |
| 216 | 215 |
| 217 startup_metric_utils::InitializePreReadOptions( | |
| 218 BrowserDistribution::GetDistribution()->GetRegistryPath()); | |
| 219 | |
| 220 // Confirm that an explicit prefetch profile is used for all process types | 216 // Confirm that an explicit prefetch profile is used for all process types |
| 221 // except for the browser process. Any new process type will have to assign | 217 // except for the browser process. Any new process type will have to assign |
| 222 // itself a prefetch id. See kPrefetchArgument* constants in | 218 // itself a prefetch id. See kPrefetchArgument* constants in |
| 223 // content_switches.cc for details. | 219 // content_switches.cc for details. |
| 224 DCHECK(process_type.empty() || | 220 DCHECK(process_type.empty() || |
| 225 HasValidWindowsPrefetchArgument(*command_line)); | 221 HasValidWindowsPrefetchArgument(*command_line)); |
| 226 | 222 |
| 227 if (process_type == crash_reporter::switches::kCrashpadHandler) { | 223 if (process_type == crash_reporter::switches::kCrashpadHandler) { |
| 228 return crash_reporter::RunAsCrashpadHandler( | 224 return crash_reporter::RunAsCrashpadHandler( |
| 229 *base::CommandLine::ForCurrentProcess()); | 225 *base::CommandLine::ForCurrentProcess()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 245 RemoveAppCompatFlagsEntry(); | 241 RemoveAppCompatFlagsEntry(); |
| 246 | 242 |
| 247 // Load and launch the chrome dll. *Everything* happens inside. | 243 // Load and launch the chrome dll. *Everything* happens inside. |
| 248 VLOG(1) << "About to load main DLL."; | 244 VLOG(1) << "About to load main DLL."; |
| 249 MainDllLoader* loader = MakeMainDllLoader(); | 245 MainDllLoader* loader = MakeMainDllLoader(); |
| 250 int rc = loader->Launch(instance); | 246 int rc = loader->Launch(instance); |
| 251 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 247 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 252 delete loader; | 248 delete loader; |
| 253 return rc; | 249 return rc; |
| 254 } | 250 } |
| OLD | NEW |