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

Unified Diff: base/debug/dump_without_crashing.cc

Issue 99523009: Move DumpProcessWithoutCrash to base, so we can use it from net and content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: base/debug/dump_without_crashing.cc
diff --git a/base/debug/dump_without_crashing.cc b/base/debug/dump_without_crashing.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a9cef3e33509f4dcee40bdddc66456fd3aa366f6
--- /dev/null
+++ b/base/debug/dump_without_crashing.cc
@@ -0,0 +1,46 @@
+// Copyright 2013 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 "base/debug/dump_without_crashing.h"
+
+#include "base/logging.h"
+
+namespace {
+
+// Pointer to the function that's called by DumpWithoutCrashing() to dump the
+// process's memory.
+#if defined(OS_POSIX)
+void (*dump_without_crashing_function_)() = NULL;
+#elif defined(OS_WIN)
+void (__cdecl *dump_without_crashing_function_)() = NULL;
Mark Mentovai 2013/12/17 20:12:09 All of these #ifdefs just for __cdecl. It’d read m
+#endif
+
+} // namespace
+
+namespace base {
+
+namespace debug {
+
+void DumpWithoutCrashing() {
+#if defined(OS_WIN) || defined(OS_POSIX)
+ if (dump_without_crashing_function_)
+ (*dump_without_crashing_function_)();
+#else
+ NOTIMPLEMENTED();
+#endif
+}
+
+#if defined(OS_POSIX)
+void SetDumpWithoutCrashingFunction(void (*function)()) {
+ dump_without_crashing_function_ = function;
+}
+#elif defined(OS_WIN)
+void SetDumpWithoutCrashingFunction(void (__cdecl *function)()) {
+ dump_without_crashing_function_ = function;
+}
+#endif
+
+} // namespace debug
+
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698