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

Unified Diff: chrome/common/dump_without_crashing.cc

Issue 12090096: Split DumpWithoutCrashing() into a separate file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 7 years, 11 months 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
« no previous file with comments | « chrome/common/dump_without_crashing.h ('k') | chrome/common/logging_chrome.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/dump_without_crashing.cc
diff --git a/chrome/common/dump_without_crashing.cc b/chrome/common/dump_without_crashing.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8c692e49c7b21f15da3b9393e50a583131ff09c5
--- /dev/null
+++ b/chrome/common/dump_without_crashing.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 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 "build/build_config.h"
+
+#include "chrome/common/dump_without_crashing.h"
+
+#include "chrome/common/chrome_constants.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
+namespace {
+
+#if defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX)
+// Pointer to the function that's called by DumpWithoutCrashing() to dump the
+// process's memory.
+void (*dump_without_crashing_function_)() = NULL;
+#endif
+
+} // namespace
+
+namespace logging {
+
+void DumpWithoutCrashing() {
+#if defined(OS_WIN)
+ // Get the breakpad pointer from chrome.exe
+ typedef void (__cdecl *DumpProcessFunction)();
+ DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>(
+ ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName),
+ "DumpProcess"));
+ if (DumpProcess)
+ DumpProcess();
+#elif defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX)
+ if (dump_without_crashing_function_)
+ (*dump_without_crashing_function_)();
+#else
+ NOTIMPLEMENTED();
+#endif
+}
+
+#if defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX)
+void SetDumpWithoutCrashingFunction(void (*function)()) {
+ dump_without_crashing_function_ = function;
+}
+#endif
+
+} // namespace logging
« no previous file with comments | « chrome/common/dump_without_crashing.h ('k') | chrome/common/logging_chrome.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698