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

Side by Side Diff: components/crash/app/hard_error_handler_win.cc

Issue 585633002: Rename BreakpadClient to CrashReporterClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows Created 6 years, 3 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
« no previous file with comments | « components/crash/app/crash_reporter_client.cc ('k') | content/content_shell.gypi » ('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 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 "components/crash/app/hard_error_handler_win.h" 5 #include "components/crash/app/hard_error_handler_win.h"
6 6
7 #if defined(_WIN32_WINNT_WIN8) && _MSC_VER < 1700 7 #if defined(_WIN32_WINNT_WIN8) && _MSC_VER < 1700
8 // The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h, and in 8 // The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h, and in
9 // delayimp.h previous to VS2012. 9 // delayimp.h previous to VS2012.
10 #undef FACILITY_VISUALCPP 10 #undef FACILITY_VISUALCPP
11 #endif 11 #endif
12 #include <DelayIMP.h> 12 #include <DelayIMP.h>
13 #include <winternl.h> 13 #include <winternl.h>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "components/crash/app/breakpad_client.h" 17 #include "components/crash/app/crash_reporter_client.h"
18 18
19 namespace breakpad { 19 namespace breakpad {
20 20
21 using crash_reporter::GetCrashReporterClient;
22
21 namespace { 23 namespace {
22 const DWORD kExceptionModuleNotFound = VcppException(ERROR_SEVERITY_ERROR, 24 const DWORD kExceptionModuleNotFound = VcppException(ERROR_SEVERITY_ERROR,
23 ERROR_MOD_NOT_FOUND); 25 ERROR_MOD_NOT_FOUND);
24 const DWORD kExceptionEntryPtNotFound = VcppException(ERROR_SEVERITY_ERROR, 26 const DWORD kExceptionEntryPtNotFound = VcppException(ERROR_SEVERITY_ERROR,
25 ERROR_PROC_NOT_FOUND); 27 ERROR_PROC_NOT_FOUND);
26 // This is defined in <ntstatus.h> but we can't include this file here. 28 // This is defined in <ntstatus.h> but we can't include this file here.
27 const DWORD FACILITY_GRAPHICS_KERNEL = 0x1E; 29 const DWORD FACILITY_GRAPHICS_KERNEL = 0x1E;
28 const DWORD NT_STATUS_ENTRYPOINT_NOT_FOUND = 0xC0000139; 30 const DWORD NT_STATUS_ENTRYPOINT_NOT_FOUND = 0xC0000139;
29 const DWORD NT_STATUS_DLL_NOT_FOUND = 0xC0000135; 31 const DWORD NT_STATUS_DLL_NOT_FOUND = 0xC0000135;
30 32
31 // We assume that exception codes are NT_STATUS codes. 33 // We assume that exception codes are NT_STATUS codes.
32 DWORD FacilityFromException(DWORD exception_code) { 34 DWORD FacilityFromException(DWORD exception_code) {
33 return (exception_code >> 16) & 0x0FFF; 35 return (exception_code >> 16) & 0x0FFF;
34 } 36 }
35 37
36 // This is not a generic function. It only works with some |nt_status| values. 38 // This is not a generic function. It only works with some |nt_status| values.
37 // Check the strings here http://msdn.microsoft.com/en-us/library/cc704588.aspx 39 // Check the strings here http://msdn.microsoft.com/en-us/library/cc704588.aspx
38 // before attempting to use this function. 40 // before attempting to use this function.
39 void RaiseHardErrorMsg(long nt_status, const std::string& p1, 41 void RaiseHardErrorMsg(long nt_status, const std::string& p1,
40 const std::string& p2) { 42 const std::string& p2) {
41 // If headless just exit silently. 43 // If headless just exit silently.
42 if (GetBreakpadClient()->IsRunningUnattended()) 44 if (GetCrashReporterClient()->IsRunningUnattended())
43 return; 45 return;
44 46
45 HMODULE ntdll = ::GetModuleHandleA("NTDLL.DLL"); 47 HMODULE ntdll = ::GetModuleHandleA("NTDLL.DLL");
46 wchar_t* msg_template = NULL; 48 wchar_t* msg_template = NULL;
47 size_t count = ::FormatMessage( 49 size_t count = ::FormatMessage(
48 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | 50 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
49 FORMAT_MESSAGE_FROM_HMODULE, 51 FORMAT_MESSAGE_FROM_HMODULE,
50 ntdll, 52 ntdll,
51 nt_status, 53 nt_status,
52 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 54 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 RaiseHardErrorMsg(exception, std::string(), std::string()); 111 RaiseHardErrorMsg(exception, std::string(), std::string());
110 return true; 112 return true;
111 #else 113 #else
112 return false; 114 return false;
113 #endif 115 #endif
114 } 116 }
115 return false; 117 return false;
116 } 118 }
117 119
118 } // namespace breakpad 120 } // namespace breakpad
OLDNEW
« no previous file with comments | « components/crash/app/crash_reporter_client.cc ('k') | content/content_shell.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698