| 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 27 matching lines...) Expand all Loading... |
| 38 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 38 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
| 39 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" | 39 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" |
| 40 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
| 41 #include "content/public/common/result_codes.h" | 41 #include "content/public/common/result_codes.h" |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = | 45 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = |
| 46 LAZY_INSTANCE_INITIALIZER; | 46 LAZY_INSTANCE_INITIALIZER; |
| 47 | 47 |
| 48 base::LazyInstance<std::vector<crash_reporter::UploadedReport>>::Leaky | 48 base::LazyInstance<std::vector<crash_reporter::Report>>::Leaky g_crash_reports = |
| 49 g_uploaded_reports = LAZY_INSTANCE_INITIALIZER; | 49 LAZY_INSTANCE_INITIALIZER; |
| 50 | 50 |
| 51 // List of switches that it's safe to rendezvous early with. Fast start should | 51 // List of switches that it's safe to rendezvous early with. Fast start should |
| 52 // not be done if a command line contains a switch not in this set. | 52 // not be done if a command line contains a switch not in this set. |
| 53 // Note this is currently stored as a list of two because it's probably faster | 53 // Note this is currently stored as a list of two because it's probably faster |
| 54 // to iterate over this small array than building a map for constant time | 54 // to iterate over this small array than building a map for constant time |
| 55 // lookups. | 55 // lookups. |
| 56 const char* const kFastStartSwitches[] = { | 56 const char* const kFastStartSwitches[] = { |
| 57 switches::kProfileDirectory, | 57 switches::kProfileDirectory, |
| 58 switches::kShowAppList, | 58 switches::kShowAppList, |
| 59 }; | 59 }; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 return false; | 194 return false; |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace | 197 } // namespace |
| 198 | 198 |
| 199 // This helper is looked up in the browser to retrieve the crash reports. See | 199 // This helper is looked up in the browser to retrieve the crash reports. See |
| 200 // CrashUploadListCrashpad. Note that we do not pass an std::vector here, | 200 // CrashUploadListCrashpad. Note that we do not pass an std::vector here, |
| 201 // because we do not want to allocate/free in different modules. The returned | 201 // because we do not want to allocate/free in different modules. The returned |
| 202 // pointer is read-only. | 202 // pointer is read-only. |
| 203 extern "C" __declspec(dllexport) void GetUploadedReportsImpl( | 203 extern "C" __declspec(dllexport) void GetCrashReportsImpl( |
| 204 const crash_reporter::UploadedReport** reports, | 204 const crash_reporter::Report** reports, |
| 205 size_t* report_count) { | 205 size_t* report_count) { |
| 206 crash_reporter::GetUploadedReports(g_uploaded_reports.Pointer()); | 206 crash_reporter::GetReports(g_crash_reports.Pointer()); |
| 207 *reports = g_uploaded_reports.Pointer()->data(); | 207 *reports = g_crash_reports.Pointer()->data(); |
| 208 *report_count = g_uploaded_reports.Pointer()->size(); | 208 *report_count = g_crash_reports.Pointer()->size(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 #if !defined(WIN_CONSOLE_APP) | 211 #if !defined(WIN_CONSOLE_APP) |
| 212 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { | 212 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { |
| 213 #else | 213 #else |
| 214 int main() { | 214 int main() { |
| 215 HINSTANCE instance = GetModuleHandle(nullptr); | 215 HINSTANCE instance = GetModuleHandle(nullptr); |
| 216 #endif | 216 #endif |
| 217 // Initialize the CommandLine singleton from the environment. | 217 // Initialize the CommandLine singleton from the environment. |
| 218 base::CommandLine::Init(0, nullptr); | 218 base::CommandLine::Init(0, nullptr); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 RemoveAppCompatFlagsEntry(); | 258 RemoveAppCompatFlagsEntry(); |
| 259 | 259 |
| 260 // Load and launch the chrome dll. *Everything* happens inside. | 260 // Load and launch the chrome dll. *Everything* happens inside. |
| 261 VLOG(1) << "About to load main DLL."; | 261 VLOG(1) << "About to load main DLL."; |
| 262 MainDllLoader* loader = MakeMainDllLoader(); | 262 MainDllLoader* loader = MakeMainDllLoader(); |
| 263 int rc = loader->Launch(instance); | 263 int rc = loader->Launch(instance); |
| 264 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 264 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 265 delete loader; | 265 delete loader; |
| 266 return rc; | 266 return rc; |
| 267 } | 267 } |
| OLD | NEW |