win: Add stubs for crash reporter.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 14 Nov 2013 05:42:28 +0000 (13:42 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 14 Nov 2013 05:42:28 +0000 (13:42 +0800)
atom.gyp
common/crash_reporter/crash_reporter_win.cc
common/crash_reporter/crash_reporter_win.h [new file with mode: 0644]

index ee99c90..e374c1d 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       'common/crash_reporter/crash_reporter_mac.h',
       'common/crash_reporter/crash_reporter_mac.mm',
       'common/crash_reporter/crash_reporter_win.cc',
+      'common/crash_reporter/crash_reporter_win.h',
       'common/draggable_region.cc',
       'common/draggable_region.h',
       'common/node_bindings.cc',
index e5187f0..ee8cbe7 100644 (file)
@@ -2,21 +2,37 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "common/crash_reporter/crash_reporter.h"
+#include "common/crash_reporter/crash_reporter_win.h"
+
+#include "base/memory/singleton.h"
 
 namespace crash_reporter {
 
-// static
-void CrashReporter::SetCompanyName(const std::string& name) {
+CrashReporterWin::CrashReporterWin()
+    : breakpad_(NULL) {
+}
+
+CrashReporterWin::~CrashReporterWin() {
+  if (breakpad_ != NULL)
+    BreakpadRelease(breakpad_);
+}
+
+void CrashReporterWin::InitBreakpad(const std::string& product_name,
+                                    const std::string& version,
+                                    const std::string& company_name,
+                                    const std::string& submit_url,
+                                    bool auto_submit,
+                                    bool skip_system_crash_handler) {
 }
 
 // static
-void CrashReporter::SetSubmissionURL(const std::string& url) {
+CrashReporterWin* CrashReporterWin::GetInstance() {
+  return Singleton<CrashReporterWin>::get();
 }
 
 // static
-void CrashReporter::SetAutoSubmit(bool yes) {
+CrashReporter* CrashReporter::GetInstance() {
+  return CrashReporterWin::GetInstance();
 }
 
 }  // namespace crash_reporter
-
diff --git a/common/crash_reporter/crash_reporter_win.h b/common/crash_reporter/crash_reporter_win.h
new file mode 100644 (file)
index 0000000..49c17ed
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright (c) 2013 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_WIN_H_
+#define ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_WIN_H_
+
+#include "base/compiler_specific.h"
+#include "common/crash_reporter/crash_reporter.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+namespace crash_reporter {
+
+class CrashReporterWin : public CrashReporter {
+ public:
+  static CrashReporterWin* GetInstance();
+
+  virtual void InitBreakpad(const std::string& product_name,
+                            const std::string& version,
+                            const std::string& company_name,
+                            const std::string& submit_url,
+                            bool auto_submit,
+                            bool skip_system_crash_handler) OVERRIDE;
+
+ private:
+  friend struct DefaultSingletonTraits<CrashReporterWin>;
+
+  CrashReporterWin();
+  virtual ~CrashReporterWin();
+
+  DISALLOW_COPY_AND_ASSIGN(CrashReporterWin);
+};
+
+}  // namespace crash_reporter
+
+#endif  // ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_WIN_H_