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

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

Issue 637023002: Misc. cleanup, primarily removing unused locals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove macros.h change Created 6 years, 2 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
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/breakpad_win.h" 5 #include "components/crash/app/breakpad_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <tchar.h> 9 #include <tchar.h>
10 #include <userenv.h> 10 #include <userenv.h>
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } else { 368 } else {
369 NtTerminateProcessPtr real_terminate_proc = 369 NtTerminateProcessPtr real_terminate_proc =
370 reinterpret_cast<NtTerminateProcessPtr>( 370 reinterpret_cast<NtTerminateProcessPtr>(
371 static_cast<char*>(g_real_terminate_process_stub)); 371 static_cast<char*>(g_real_terminate_process_stub));
372 real_terminate_proc(::GetCurrentProcess(), content::RESULT_CODE_KILLED); 372 real_terminate_proc(::GetCurrentProcess(), content::RESULT_CODE_KILLED);
373 } 373 }
374 } 374 }
375 return EXCEPTION_CONTINUE_SEARCH; 375 return EXCEPTION_CONTINUE_SEARCH;
376 } 376 }
377 377
378 #ifndef _WIN64
378 static NTSTATUS WINAPI HookNtTerminateProcess(HANDLE ProcessHandle, 379 static NTSTATUS WINAPI HookNtTerminateProcess(HANDLE ProcessHandle,
379 NTSTATUS ExitStatus) { 380 NTSTATUS ExitStatus) {
380 if (g_breakpad && 381 if (g_breakpad &&
381 (ProcessHandle == ::GetCurrentProcess() || ProcessHandle == NULL)) { 382 (ProcessHandle == ::GetCurrentProcess() || ProcessHandle == NULL)) {
382 NT_TIB* tib = reinterpret_cast<NT_TIB*>(NtCurrentTeb()); 383 NT_TIB* tib = reinterpret_cast<NT_TIB*>(NtCurrentTeb());
383 void* address_on_stack = _AddressOfReturnAddress(); 384 void* address_on_stack = _AddressOfReturnAddress();
384 if (address_on_stack < tib->StackLimit || 385 if (address_on_stack < tib->StackLimit ||
385 address_on_stack > tib->StackBase) { 386 address_on_stack > tib->StackBase) {
386 g_surrogate_exception_record.ExceptionAddress = _ReturnAddress(); 387 g_surrogate_exception_record.ExceptionAddress = _ReturnAddress();
387 g_surrogate_exception_record.ExceptionCode = DBG_TERMINATE_PROCESS; 388 g_surrogate_exception_record.ExceptionCode = DBG_TERMINATE_PROCESS;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 DWORD dummy = 0; 434 DWORD dummy = 0;
434 CHECK(::VirtualProtect(terminate_process_func_address, 435 CHECK(::VirtualProtect(terminate_process_func_address,
435 5, 436 5,
436 old_protect, 437 old_protect,
437 &dummy)); 438 &dummy));
438 CHECK(::VirtualProtect(g_real_terminate_process_stub, 439 CHECK(::VirtualProtect(g_real_terminate_process_stub,
439 sidestep::kMaxPreambleStubSize, 440 sidestep::kMaxPreambleStubSize,
440 old_protect, 441 old_protect,
441 &old_protect)); 442 &old_protect));
442 } 443 }
444 #endif
443 445
444 static void InitPipeNameEnvVar(bool is_per_user_install) { 446 static void InitPipeNameEnvVar(bool is_per_user_install) {
445 scoped_ptr<base::Environment> env(base::Environment::Create()); 447 scoped_ptr<base::Environment> env(base::Environment::Create());
446 if (env->HasVar(kPipeNameVar)) { 448 if (env->HasVar(kPipeNameVar)) {
447 // The Breakpad pipe name is already configured: nothing to do. 449 // The Breakpad pipe name is already configured: nothing to do.
448 return; 450 return;
449 } 451 }
450 452
451 // Check whether configuration management controls crash reporting. 453 // Check whether configuration management controls crash reporting.
452 bool crash_reporting_enabled = true; 454 bool crash_reporting_enabled = true;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 extern "C" void __declspec(dllexport) __cdecl 690 extern "C" void __declspec(dllexport) __cdecl
689 UnregisterNonABICompliantCodeRange(void* start) { 691 UnregisterNonABICompliantCodeRange(void* start) {
690 ExceptionHandlerRecord* record = 692 ExceptionHandlerRecord* record =
691 reinterpret_cast<ExceptionHandlerRecord*>(start); 693 reinterpret_cast<ExceptionHandlerRecord*>(start);
692 694
693 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); 695 CHECK(RtlDeleteFunctionTable(&record->runtime_function));
694 } 696 }
695 #endif 697 #endif
696 698
697 } // namespace breakpad 699 } // namespace breakpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698