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

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

Issue 1507413003: clang/win: Let some chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content_browsertests Created 5 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
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/content/app/hard_error_handler_win.h" 5 #include "components/crash/content/app/hard_error_handler_win.h"
6 6
7 #include <DelayIMP.h> 7 #include <DelayIMP.h>
8 #include <winternl.h> 8 #include <winternl.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 15 matching lines...) Expand all
26 const DWORD NT_STATUS_DLL_NOT_FOUND = 0xC0000135; 26 const DWORD NT_STATUS_DLL_NOT_FOUND = 0xC0000135;
27 27
28 // We assume that exception codes are NT_STATUS codes. 28 // We assume that exception codes are NT_STATUS codes.
29 DWORD FacilityFromException(DWORD exception_code) { 29 DWORD FacilityFromException(DWORD exception_code) {
30 return (exception_code >> 16) & 0x0FFF; 30 return (exception_code >> 16) & 0x0FFF;
31 } 31 }
32 32
33 // This is not a generic function. It only works with some |nt_status| values. 33 // This is not a generic function. It only works with some |nt_status| values.
34 // Check the strings here http://msdn.microsoft.com/en-us/library/cc704588.aspx 34 // Check the strings here http://msdn.microsoft.com/en-us/library/cc704588.aspx
35 // before attempting to use this function. 35 // before attempting to use this function.
36 void RaiseHardErrorMsg(long nt_status, const std::string& p1, 36 void RaiseHardErrorMsg(DWORD nt_status,
37 const std::string& p2) { 37 const std::string& p1,
38 const std::string& p2) {
38 // If headless just exit silently. 39 // If headless just exit silently.
39 if (GetCrashReporterClient()->IsRunningUnattended()) 40 if (GetCrashReporterClient()->IsRunningUnattended())
40 return; 41 return;
41 42
42 HMODULE ntdll = ::GetModuleHandleA("NTDLL.DLL"); 43 HMODULE ntdll = ::GetModuleHandleA("NTDLL.DLL");
43 wchar_t* msg_template = NULL; 44 wchar_t* msg_template = NULL;
44 size_t count = ::FormatMessage( 45 size_t count = ::FormatMessage(
45 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | 46 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
46 FORMAT_MESSAGE_FROM_HMODULE, 47 FORMAT_MESSAGE_FROM_HMODULE,
47 ntdll, 48 ntdll,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 89 }
89 90
90 } // namespace 91 } // namespace
91 92
92 bool HardErrorHandler(EXCEPTION_POINTERS* ex_info) { 93 bool HardErrorHandler(EXCEPTION_POINTERS* ex_info) {
93 if (!ex_info) 94 if (!ex_info)
94 return false; 95 return false;
95 if (!ex_info->ExceptionRecord) 96 if (!ex_info->ExceptionRecord)
96 return false; 97 return false;
97 98
98 long exception = ex_info->ExceptionRecord->ExceptionCode; 99 DWORD exception = ex_info->ExceptionRecord->ExceptionCode;
99 if (exception == kExceptionModuleNotFound) { 100 if (exception == kExceptionModuleNotFound) {
100 ModuleNotFoundHardError(ex_info->ExceptionRecord); 101 ModuleNotFoundHardError(ex_info->ExceptionRecord);
101 return true; 102 return true;
102 } else if (exception == kExceptionEntryPtNotFound) { 103 } else if (exception == kExceptionEntryPtNotFound) {
103 EntryPointNotFoundHardError(ex_info->ExceptionRecord); 104 EntryPointNotFoundHardError(ex_info->ExceptionRecord);
104 return true; 105 return true;
105 } else if (FacilityFromException(exception) == FACILITY_GRAPHICS_KERNEL) { 106 } else if (FacilityFromException(exception) == FACILITY_GRAPHICS_KERNEL) {
106 RaiseHardErrorMsg(exception, std::string(), std::string()); 107 RaiseHardErrorMsg(exception, std::string(), std::string());
107 return true; 108 return true;
108 } 109 }
109 return false; 110 return false;
110 } 111 }
111 112
112 } // namespace breakpad 113 } // namespace breakpad
OLDNEW
« no previous file with comments | « cloud_print/virtual_driver/win/install/setup.cc ('k') | content/browser/accessibility/accessibility_tree_formatter_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698