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

Side by Side 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, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/dump_without_crashing.h ('k') | chrome/common/logging_chrome.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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"
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 } // namespace
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
OLDNEW
« 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