forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding crash utilities to chromecast/crash.
Includes initial commits for writing, managing, and uploading information generated on Linux crashes. Change-Id: I6ff36ffb54bf9153e5663844b2a428ce7b03773f BUG= b/20121400 Review URL: https://codereview.chromium.org/1154383006 Cr-Commit-Position: refs/heads/master@{#335727}
- Loading branch information
slan
authored and
Commit bot
committed
Jun 23, 2015
1 parent
8d84d9c
commit f48fe87
Showing
46 changed files
with
2,602 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
include_rules = [ | ||
# Includes for JNI. | ||
"+chromecast/android", | ||
"+chromecast/app/android", | ||
"+chromecast/browser/android", | ||
"+chromecast/crash/android", | ||
"+components/external_video_surface", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2015 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import("//testing/test.gni") | ||
|
||
component("cast_crash_client") { | ||
sources = [ | ||
"android/cast_crash_reporter_client_androic.cc", | ||
"android/cast_crash_reporter_client_android.h", | ||
"linux/cast_crash_reporter_client.cc", | ||
"linux/cast_crash_reporter_client.h", | ||
] | ||
|
||
deps = [ | ||
"//chromecast/crash", | ||
"//components/crash/app", | ||
"//content/public/common", | ||
] | ||
|
||
configs += [ "//chromecast:config" ] | ||
} | ||
|
||
test("cast_shell_unittests") { | ||
sources = [ | ||
"linux/cast_crash_reporter_client_unittest.cc", | ||
] | ||
|
||
deps = [ | ||
":cast_crash_client", | ||
"//base/test:run_all_unittests", | ||
"//testing/gtest", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include_rules = [ | ||
"+breakpad", | ||
"+chromecast/android", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chromecast/app/linux/cast_crash_reporter_client.h" | ||
|
||
#include "base/time/time.h" | ||
#include "chromecast/base/error_codes.h" | ||
#include "chromecast/crash/linux/crash_util.h" | ||
#include "components/crash/app/breakpad_linux.h" | ||
#include "content/public/common/content_switches.h" | ||
|
||
namespace chromecast { | ||
|
||
namespace { | ||
|
||
std::string* g_process_type = nullptr; | ||
uint64_t g_process_start_time_ms = 0u; | ||
|
||
} // namespace | ||
|
||
// static | ||
void CastCrashReporterClient::InitCrashReporter( | ||
const std::string& process_type) { | ||
DCHECK(!g_process_type); | ||
g_process_start_time_ms = | ||
(base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds(); | ||
|
||
// Save the process type (leaked). | ||
g_process_type = new std::string(process_type); | ||
|
||
// Start up breakpad for this process, if applicable. | ||
breakpad::InitCrashReporter(process_type); | ||
} | ||
|
||
// static | ||
const char* CastCrashReporterClient::GetProcessType() { | ||
return g_process_type ? g_process_type->c_str() : nullptr; | ||
} | ||
|
||
// static | ||
uint64_t CastCrashReporterClient::GetProcessStartTime() { | ||
return g_process_start_time_ms; | ||
} | ||
|
||
CastCrashReporterClient::CastCrashReporterClient() { | ||
} | ||
CastCrashReporterClient::~CastCrashReporterClient() { | ||
} | ||
|
||
bool CastCrashReporterClient::EnableBreakpadForProcess( | ||
const std::string& process_type) { | ||
return process_type == switches::kRendererProcess || | ||
process_type == switches::kZygoteProcess || | ||
process_type == switches::kGpuProcess; | ||
} | ||
|
||
bool CastCrashReporterClient::HandleCrashDump(const char* crashdump_filename) { | ||
// Set the initial error code to ERROR_WEB_CONTENT_RENDER_VIEW_GONE to show | ||
// an error message on next cast_shell run. Though the error code is for | ||
// renderer process crash, the actual messages can be used for browser process | ||
// as well. | ||
if (!GetProcessType() || !strcmp(GetProcessType(), "")) | ||
SetInitialErrorCode(ERROR_WEB_CONTENT_RENDER_VIEW_GONE); | ||
|
||
// Upload crash dump. If user didn't opt-in crash report, minidump writer | ||
// instantiated within CrashUtil::RequestUploadCrashDump() does nothing. | ||
CrashUtil::RequestUploadCrashDump(crashdump_filename, | ||
GetProcessType() ? GetProcessType() : "", | ||
GetProcessStartTime()); | ||
|
||
// Always return true to indicate that this crash dump has been processed, | ||
// so that it won't fallback to use chrome's default uploader. | ||
return true; | ||
} | ||
|
||
} // namespace chromecast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.