#include "atom/browser/javascript_environment.h"
#include "atom/browser/node_debugger.h"
#include "atom/common/api/atom_bindings.h"
+#include "atom/common/crash_reporter/crash_reporter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#endif
process.SetMethod("crash", &AtomBindings::Crash);
- mate::Dictionary crashReporter =
- mate::Dictionary::CreateEmpty(gin_env.isolate());
- crashReporter.SetMethod("start", &AtomBindings::StartCrashReporter);
+ auto crashReporter = mate::Dictionary::CreateEmpty(gin_env.isolate());
+ crashReporter.SetMethod("start",
+ &crash_reporter::CrashReporter::StartInstance);
process.Set("crashReporter", crashReporter);
node::LoadEnvironment(env);
#include "atom/common/atom_version.h"
#include "atom/common/chrome_version.h"
-#include "atom/common/crash_reporter/crash_reporter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/node_includes.h"
#include "base/logging.h"
static_cast<DummyClass*>(nullptr)->crash = true;
}
-// static
-void AtomBindings::StartCrashReporter(const mate::Dictionary& options) {
- crash_reporter::CrashReporter::GetInstance()->StartWithOptions(options);
-}
-
} // namespace atom
CrashReporter::~CrashReporter() {
}
-void CrashReporter::StartWithOptions(const mate::Dictionary& options) {
- std::string product_name;
- options.Get("productName", &product_name);
- std::string company_name;
- options.Get("companyName", &company_name);
- std::string submit_url;
- options.Get("submitURL", &submit_url);
- base::FilePath crashes_dir;
- options.Get("crashesDirectory", &crashes_dir);
- StringMap extra_parameters;
- options.Get("extra", &extra_parameters);
-
- extra_parameters["_productName"] = product_name;
- extra_parameters["_companyName"] = company_name;
-
- Start(product_name, company_name, submit_url, crashes_dir, true, false,
- extra_parameters);
-}
-
void CrashReporter::Start(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
}
#endif
+void CrashReporter::StartInstance(const mate::Dictionary& options) {
+ auto reporter = GetInstance();
+ if (!reporter) return;
+
+ std::string product_name;
+ options.Get("productName", &product_name);
+ std::string company_name;
+ options.Get("companyName", &company_name);
+ std::string submit_url;
+ options.Get("submitURL", &submit_url);
+ base::FilePath crashes_dir;
+ options.Get("crashesDirectory", &crashes_dir);
+ StringMap extra_parameters;
+ options.Get("extra", &extra_parameters);
+
+ extra_parameters["_productName"] = product_name;
+ extra_parameters["_companyName"] = company_name;
+
+ reporter->Start(product_name, company_name, submit_url, crashes_dir, true,
+ false, extra_parameters);
+}
+
+
} // namespace crash_reporter
typedef std::pair<int, std::string> UploadReportResult; // upload-date, id
static CrashReporter* GetInstance();
+ static void StartInstance(const mate::Dictionary& options);
void Start(const std::string& product_name,
const std::string& company_name,
bool upload_to_server,
bool skip_system_crash_handler,
const StringMap& extra_parameters);
- void StartWithOptions(const mate::Dictionary& options);
-
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
const base::FilePath& crashes_dir);