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

Side by Side Diff: chromecast/crash/cast_crash_reporter_client.cc

Issue 731933005: Chromecast: adds crash handling for Linux build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 2014 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 "chromecast/crash/cast_crash_reporter_client.h"
6
7 #include "base/time/time.h"
8 #include "components/crash/app/breakpad_linux.h"
9 #include "content/public/common/content_switches.h"
10
11 namespace chromecast {
12
13 namespace {
14
15 char* g_process_type = NULL;
16 uint64_t g_process_start_time = 0;
17
18 } // namespace
19
20 // static
21 void CastCrashReporterClient::InitCrashReporter(
22 const std::string& process_type) {
23 g_process_start_time = (base::TimeTicks::Now() -
24 base::TimeTicks()).InMilliseconds();
25
26 // Save the process type (leaked).
27 // Note: "browser" process is identified by empty process type string.
28 const std::string& named_process_type(
29 process_type.empty() ? "browser" : process_type);
30 const size_t process_type_len = named_process_type.size() + 1;
31 g_process_type = new char[process_type_len];
32 strncpy(g_process_type, named_process_type.c_str(), process_type_len);
33
34 // Start up breakpad for this process, if applicable.
35 breakpad::InitCrashReporter(process_type);
36 }
37
38 // static
39 char* CastCrashReporterClient::GetProcessType() {
40 return g_process_type;
41 }
42
43 // static
44 uint64_t CastCrashReporterClient::GetProcessStartTime() {
45 return g_process_start_time;
46 }
47
48 CastCrashReporterClient::CastCrashReporterClient() {}
49 CastCrashReporterClient::~CastCrashReporterClient() {}
50
51 bool CastCrashReporterClient::EnableBreakpadForProcess(
52 const std::string& process_type) {
53 return process_type == switches::kRendererProcess ||
54 process_type == switches::kZygoteProcess ||
55 process_type == switches::kGpuProcess;
56 }
57
58 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/crash/cast_crash_reporter_client.h ('k') | chromecast/crash/cast_crash_reporter_client_simple.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698