Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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 "build/build_config.h" | |
|
Lei Zhang
2013/01/31 21:56:22
this should go in the header file, since that uses
Mark Seaborn
2013/01/31 23:09:26
Done.
| |
| 6 | |
| 7 #include "chrome/common/dump_without_crashing.h" | |
| 8 | |
| 9 #include "chrome/common/chrome_constants.h" | |
| 10 | |
| 11 #if defined(OS_WIN) | |
| 12 #include <windows.h> | |
| 13 #endif | |
| 14 | |
| 15 namespace { | |
| 16 | |
| 17 #if defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX) | |
| 18 // Pointer to the function that's called by DumpWithoutCrashing() to dump the | |
| 19 // process's memory. | |
| 20 void (*dump_without_crashing_function_)() = NULL; | |
| 21 #endif | |
| 22 | |
| 23 } // anonymous namespace | |
|
Lei Zhang
2013/01/31 21:56:22
nit: just // namespace
Mark Seaborn
2013/01/31 23:09:26
Done.
| |
| 24 | |
| 25 namespace logging { | |
| 26 | |
| 27 void DumpWithoutCrashing() { | |
| 28 #if defined(OS_WIN) | |
| 29 // Get the breakpad pointer from chrome.exe | |
| 30 typedef void (__cdecl *DumpProcessFunction)(); | |
| 31 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( | |
| 32 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName), | |
| 33 "DumpProcess")); | |
| 34 if (DumpProcess) | |
| 35 DumpProcess(); | |
| 36 #elif defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX) | |
| 37 if (dump_without_crashing_function_) | |
| 38 (*dump_without_crashing_function_)(); | |
| 39 #else | |
| 40 NOTIMPLEMENTED(); | |
| 41 #endif | |
| 42 } | |
| 43 | |
| 44 #if defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX) | |
| 45 void SetDumpWithoutCrashingFunction(void (*function)()) { | |
| 46 dump_without_crashing_function_ = function; | |
| 47 } | |
| 48 #endif | |
| 49 | |
| 50 } // namespace logging | |
| OLD | NEW |