Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: components/crash/content/app/fallback_crash_handling_win.cc

Issue 2638433002: Integrate fallback crash handling in chrome (Closed)
Patch Set: Reorganize the fallback integration code into a pair of separate files. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/crash/content/app/fallback_crash_handling_win.h"
6
7 #include <memory>
8 #include <string>
scottmg 2017/01/13 22:20:00 Can remove this, it's already in the header
Sigurður Ásgeirsson 2017/01/16 18:23:24 Done.
9
10 #include "base/command_line.h"
11 #include "components/crash/content/app/crash_switches.h"
12 #include "components/crash/content/app/fallback_crash_handler_launcher_win.h"
13 #include "components/crash/content/app/fallback_crash_handler_win.h"
14
15 namespace crash_reporter {
16
17 namespace switches {
18 const char kFallbackCrashHandler[] = "fallback-handler";
19 }
20
21 namespace {
22
23 std::unique_ptr<FallbackCrashHandlerLauncher> g_fallback_crash_handler_launcher;
24
25 LONG WINAPI FallbackUnhandledExceptionFilter(EXCEPTION_POINTERS* exc_ptrs) {
scottmg 2017/01/13 22:20:00 This doesn't seem to be used? And apropros of tha
Sigurður Ásgeirsson 2017/01/13 22:40:28 I sure hope so. Monday, first thing. I wanna ship
26 if (!g_fallback_crash_handler_launcher)
27 return EXCEPTION_CONTINUE_SEARCH;
28
29 return g_fallback_crash_handler_launcher->LaunchAndWaitForHandler(exc_ptrs);
30 }
31
32 } // namespace
33
34 void SetupFallbackCrashHandling(const base::CommandLine& command_line) {
35 // Run the same program.
36 base::CommandLine base_command_line(command_line.GetProgram());
37 base_command_line.AppendSwitchASCII("type", switches::kFallbackCrashHandler);
38
39 // Get the database path.
40 base::FilePath database_path = command_line.GetSwitchValuePath("database");
41 if (database_path.empty()) {
42 NOTREACHED();
43 return;
44 }
45
46 std::unique_ptr<FallbackCrashHandlerLauncher> fallback_launcher(
47 new FallbackCrashHandlerLauncher());
48
49 if (!fallback_launcher->Initialize(base_command_line, database_path)) {
50 NOTREACHED();
51 return;
52 }
53
54 // Success, pass ownership to the global.
55 g_fallback_crash_handler_launcher = std::move(fallback_launcher);
56 }
57
58 int RunAsFallbackCrashHandler(const base::CommandLine& command_line,
59 std::string product_name,
60 std::string version,
61 std::string channel_name) {
62 FallbackCrashHandler fallback_handler;
63
64 if (!fallback_handler.ParseCommandLine(command_line)) {
65 // TODO(siggi): Figure out how to UMA from this process, if need be.
66 return 1;
67 }
68
69 if (!fallback_handler.GenerateCrashDump(
70 product_name, version, channel_name,
71 crash_reporter::switches::kCrashpadHandler)) {
72 // TODO(siggi): Figure out how to UMA from this process, if need be.
73 return 2;
74 }
75
76 return 0;
77 }
78
79 } // namespace crash_reporter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698