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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/debug/dump_without_crashing.h ('k') | base/native_library.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "base/debug/dump_without_crashing.h"
6
7 #include "chrome/common/dump_without_crashing.h"
8 6
9 #include "base/logging.h" 7 #include "base/logging.h"
10 #include "chrome/common/chrome_constants.h"
11
12 #if defined(OS_WIN)
13 #include <windows.h>
14 #endif
15 8
16 namespace { 9 namespace {
17 10
18 #if defined(OS_POSIX)
19 // Pointer to the function that's called by DumpWithoutCrashing() to dump the 11 // Pointer to the function that's called by DumpWithoutCrashing() to dump the
20 // process's memory. 12 // process's memory.
21 void (*dump_without_crashing_function_)() = NULL; 13 void (CDECL *dump_without_crashing_function_)() = NULL;
22 #endif
23 14
24 } // namespace 15 } // namespace
25 16
26 namespace logging { 17 namespace base {
18
19 namespace debug {
27 20
28 void DumpWithoutCrashing() { 21 void DumpWithoutCrashing() {
29 #if defined(OS_WIN)
30 // Get the breakpad pointer from chrome.exe
31 typedef void (__cdecl *DumpProcessFunction)();
32 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>(
33 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName),
34 "DumpProcessWithoutCrash"));
35 if (DumpProcess)
36 DumpProcess();
37 #elif defined(OS_POSIX)
38 if (dump_without_crashing_function_) 22 if (dump_without_crashing_function_)
39 (*dump_without_crashing_function_)(); 23 (*dump_without_crashing_function_)();
40 #else
41 NOTIMPLEMENTED();
42 #endif
43 } 24 }
44 25
45 #if defined(OS_POSIX) 26 void SetDumpWithoutCrashingFunction(void (CDECL *function)()) {
46 void SetDumpWithoutCrashingFunction(void (*function)()) {
47 dump_without_crashing_function_ = function; 27 dump_without_crashing_function_ = function;
48 } 28 }
49 #endif
50 29
51 } // namespace logging 30 } // namespace debug
31
32 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/dump_without_crashing.h ('k') | base/native_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698