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

Side by Side Diff: chrome/common/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 | « chrome/common/dump_without_crashing.h ('k') | chrome/common/logging_chrome.cc » ('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 "base/logging.h"
10 #include "chrome/common/chrome_constants.h"
11
12 #if defined(OS_WIN)
13 #include <windows.h>
14 #endif
15
16 namespace {
17
18 #if defined(OS_POSIX)
19 // Pointer to the function that's called by DumpWithoutCrashing() to dump the
20 // process's memory.
21 void (*dump_without_crashing_function_)() = NULL;
22 #endif
23
24 } // namespace
25
26 namespace logging {
27
28 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_)
39 (*dump_without_crashing_function_)();
40 #else
41 NOTIMPLEMENTED();
42 #endif
43 }
44
45 #if defined(OS_POSIX)
46 void SetDumpWithoutCrashingFunction(void (*function)()) {
47 dump_without_crashing_function_ = function;
48 }
49 #endif
50
51 } // namespace logging
OLDNEW
« no previous file with comments | « chrome/common/dump_without_crashing.h ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698