OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/debug/dump_without_crashing.h" | |
6 | |
7 #include "base/logging.h" | |
8 | |
9 namespace { | |
10 | |
11 // Pointer to the function that's called by DumpWithoutCrashing() to dump the | |
12 // process's memory. | |
13 #if defined(OS_POSIX) | |
14 void (*dump_without_crashing_function_)() = NULL; | |
15 #elif defined(OS_WIN) | |
16 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
| |
17 #endif | |
18 | |
19 } // namespace | |
20 | |
21 namespace base { | |
22 | |
23 namespace debug { | |
24 | |
25 void DumpWithoutCrashing() { | |
26 #if defined(OS_WIN) || defined(OS_POSIX) | |
27 if (dump_without_crashing_function_) | |
28 (*dump_without_crashing_function_)(); | |
29 #else | |
30 NOTIMPLEMENTED(); | |
31 #endif | |
32 } | |
33 | |
34 #if defined(OS_POSIX) | |
35 void SetDumpWithoutCrashingFunction(void (*function)()) { | |
36 dump_without_crashing_function_ = function; | |
37 } | |
38 #elif defined(OS_WIN) | |
39 void SetDumpWithoutCrashingFunction(void (__cdecl *function)()) { | |
40 dump_without_crashing_function_ = function; | |
41 } | |
42 #endif | |
43 | |
44 } // namespace debug | |
45 | |
46 } // namespace base | |
OLD | NEW |