Skip to content

Commit

Permalink
Merge pull request brave#125 from brave/crashReporter
Browse files Browse the repository at this point in the history
Fix crash reporter for C54
  • Loading branch information
bridiver authored Dec 19, 2016
2 parents fdb924c + 029117f commit 0afe7fe
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 34 deletions.
34 changes: 19 additions & 15 deletions atom/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source_set("node") {
sources = [
"api/atom_api_asar.cc",
"api/atom_api_clipboard.cc",
# "api/atom_api_crash_reporter.cc",
"api/atom_api_crash_reporter.cc",
"api/atom_api_key_weak_map.h",
"api/atom_api_native_image.cc",
"api/atom_api_native_image.h",
Expand Down Expand Up @@ -91,8 +91,8 @@ source_set("common") {
"color_util.h",
"common_message_generator.cc",
"common_message_generator.h",
# "crash_reporter/crash_reporter.cc",
# "crash_reporter/crash_reporter.h",
"crash_reporter/crash_reporter.cc",
"crash_reporter/crash_reporter.h",
"google_api_key.h",
"importer/chrome_importer_utils.cc",
"importer/chrome_importer_utils.h",
Expand Down Expand Up @@ -124,10 +124,14 @@ source_set("common") {
]

if (is_mac) {
deps += [
"//third_party/crashpad/crashpad/client"
]

sources += [
"api/atom_api_native_image_mac.mm",
# "crash_reporter/crash_reporter_mac.h",
# "crash_reporter/crash_reporter_mac.mm",
"crash_reporter/crash_reporter_mac.h",
"crash_reporter/crash_reporter_mac.mm",
"importer/chrome_importer_utils_mac.mm",
"node_bindings_mac.cc",
"node_bindings_mac.h",
Expand All @@ -147,10 +151,10 @@ source_set("common") {

if (is_linux) {
sources += [
# "crash_reporter/crash_reporter_linux.cc",
# "crash_reporter/crash_reporter_linux.h",
# "crash_reporter/linux/crash_dump_handler.cc",
# "crash_reporter/linux/crash_dump_handler.h",
"crash_reporter/crash_reporter_linux.cc",
"crash_reporter/crash_reporter_linux.h",
"crash_reporter/linux/crash_dump_handler.cc",
"crash_reporter/linux/crash_dump_handler.h",
"importer/chrome_importer_utils_linux.cc",
"linux/application_info.cc",
"node_bindings_linux.cc",
Expand All @@ -161,12 +165,12 @@ source_set("common") {

if (is_win) {
sources += [
# "crash_reporter/crash_reporter_win.cc",
# "crash_reporter/crash_reporter_win.h",
# "crash_reporter/win/crash_service.cc",
# "crash_reporter/win/crash_service.h",
# "crash_reporter/win/crash_service_main.cc",
# "crash_reporter/win/crash_service_main.h",
"crash_reporter/crash_reporter_win.cc",
"crash_reporter/crash_reporter_win.h",
"crash_reporter/win/crash_service.cc",
"crash_reporter/win/crash_service.h",
"crash_reporter/win/crash_service_main.cc",
"crash_reporter/win/crash_service_main.h",
"importer/chrome_importer_utils_win.cc",
"node_bindings_win.cc",
"node_bindings_win.h",
Expand Down
3 changes: 2 additions & 1 deletion atom/common/crash_reporter/crash_reporter_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "base/memory/singleton.h"
#include "base/process/memory.h"
#include "base/strings/stringprintf.h"
#include "chrome/common/chrome_version.h"
#include "vendor/breakpad/src/client/linux/handler/exception_handler.h"
#include "vendor/breakpad/src/common/linux/linux_libc_support.h"

Expand Down Expand Up @@ -64,7 +65,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
bool skip_system_crash_handler) {
EnableCrashDumping(product_name);

crash_keys_.SetKeyValue("prod", ATOM_PRODUCT_NAME);
crash_keys_.SetKeyValue("prod", PRODUCT_SHORTNAME_STRING);
crash_keys_.SetKeyValue("ver", version.c_str());
upload_url_ = submit_url;

Expand Down
2 changes: 1 addition & 1 deletion atom/common/crash_reporter/crash_reporter_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "atom/common/crash_reporter/crash_reporter.h"
#include "base/compiler_specific.h"
#include "base/strings/string_piece.h"
#include "vendor/crashpad/client/simple_string_dictionary.h"
#include "third_party/crashpad/crashpad/client/simple_string_dictionary.h"

namespace base {
template <typename T> struct DefaultSingletonTraits;
Expand Down
13 changes: 7 additions & 6 deletions atom/common/crash_reporter/crash_reporter_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#include "vendor/crashpad/client/crash_report_database.h"
#include "vendor/crashpad/client/crashpad_client.h"
#include "vendor/crashpad/client/crashpad_info.h"
#include "vendor/crashpad/client/settings.h"
#include "chrome/common/chrome_version.h"
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "third_party/crashpad/crashpad/client/crashpad_info.h"
#include "third_party/crashpad/crashpad/client/settings.h"

namespace crash_reporter {

Expand All @@ -44,7 +45,7 @@
@autoreleasepool {
base::FilePath framework_bundle_path = base::mac::FrameworkBundlePath();
base::FilePath handler_path =
framework_bundle_path.Append("Resources").Append("crashpad_handler");
framework_bundle_path.Append("Helpers").Append("crashpad_handler");

crashpad::CrashpadClient crashpad_client;
if (crashpad_client.StartHandler(handler_path, database_path,
Expand All @@ -67,7 +68,7 @@
simple_string_dictionary_.reset(new crashpad::SimpleStringDictionary());
crashpad_info->set_simple_annotations(simple_string_dictionary_.get());

SetCrashKeyValue("prod", CHROMIUM_SHORT_NAME);
SetCrashKeyValue("prod", PRODUCT_SHORTNAME_STRING);
SetCrashKeyValue("process_type", is_browser_ ? "browser" : "renderer");
SetCrashKeyValue("ver", version);

Expand Down
2 changes: 1 addition & 1 deletion atom/common/node_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ REFERENCE_MODULE(atom_browser_window);
REFERENCE_MODULE(atom_browser_extension);
REFERENCE_MODULE(atom_common_asar);
REFERENCE_MODULE(atom_common_clipboard);
// REFERENCE_MODULE(atom_common_crash_reporter);
REFERENCE_MODULE(atom_common_crash_reporter);
REFERENCE_MODULE(atom_common_native_image);
REFERENCE_MODULE(atom_common_screen);
REFERENCE_MODULE(atom_common_shell);
Expand Down
2 changes: 1 addition & 1 deletion lib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ action("lib") {
"browser/api/browser-window.js",
"browser/api/component-updater.js",
"browser/api/content-tracing.js",
"browser/api/crash-reporter.js",
"browser/api/dialog.js",
"browser/api/exports/electron.js",
"browser/api/global-shortcut.js",
Expand All @@ -38,7 +39,6 @@ action("lib") {
"browser/rpc-server.js",
"common/api/callbacks-registry.js",
"common/api/clipboard.js",
"common/api/crash-reporter.js",
"common/api/deprecate.js",
"common/api/deprecations.js",
"common/api/is-promise.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
const os = require('os')
const path = require('path')
const spawn = require('child_process').spawn
const electron = require('electron')
const {app} = require('electron')
const binding = process.atomBinding('crash_reporter')

var CrashReporter = (function () {
function CrashReporter () {}

CrashReporter.prototype.start = function (options) {
var app, args, autoSubmit, companyName, env, extra, ignoreSystemCrashHandler, start, submitURL
var args, autoSubmit, companyName, env, extra, ignoreSystemCrashHandler, start, submitURL
if (options == null) {
options = {}
}
Expand All @@ -21,7 +21,6 @@ var CrashReporter = (function () {
ignoreSystemCrashHandler = options.ignoreSystemCrashHandler
extra = options.extra

app = (process.type === 'browser' ? electron : electron.remote).app
if (this.productName == null) {
this.productName = app.getName()
}
Expand Down
6 changes: 6 additions & 0 deletions lib/browser/api/exports/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Object.defineProperties(exports, {
return require('../auto-updater')
}
},
crashReporter: {
enumerable: true,
get: function () {
return require('../crash-reporter')
}
},
BrowserWindow: {
enumerable: true,
get: function () {
Expand Down
6 changes: 0 additions & 6 deletions lib/common/api/exports/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ exports.defineProperties = function (exports) {
return require('../clipboard')
}
},
// crashReporter: {
// enumerable: true,
// get: function () {
// return require('../crash-reporter')
// }
// },
nativeImage: {
enumerable: true,
get: function () {
Expand Down

0 comments on commit 0afe7fe

Please sign in to comment.