| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/win/wrapped_window_proc.h" | 5 #include "base/win/wrapped_window_proc.h" |
| 6 | 6 |
| 7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
| 8 #include "base/logging.h" |
| 9 #include "base/process_util.h" |
| 8 | 10 |
| 9 namespace { | 11 namespace { |
| 10 | 12 |
| 11 base::win::WinProcExceptionFilter s_exception_filter = NULL; | 13 base::win::WinProcExceptionFilter s_exception_filter = NULL; |
| 12 | 14 |
| 13 } // namespace. | 15 } // namespace. |
| 14 | 16 |
| 15 namespace base { | 17 namespace base { |
| 16 namespace win { | 18 namespace win { |
| 17 | 19 |
| 18 WinProcExceptionFilter SetWinProcExceptionFilter( | 20 WinProcExceptionFilter SetWinProcExceptionFilter( |
| 19 WinProcExceptionFilter filter) { | 21 WinProcExceptionFilter filter) { |
| 20 subtle::AtomicWord rv = subtle::NoBarrier_AtomicExchange( | 22 subtle::AtomicWord rv = subtle::NoBarrier_AtomicExchange( |
| 21 reinterpret_cast<subtle::AtomicWord*>(&s_exception_filter), | 23 reinterpret_cast<subtle::AtomicWord*>(&s_exception_filter), |
| 22 reinterpret_cast<subtle::AtomicWord>(filter)); | 24 reinterpret_cast<subtle::AtomicWord>(filter)); |
| 23 return reinterpret_cast<WinProcExceptionFilter>(rv); | 25 return reinterpret_cast<WinProcExceptionFilter>(rv); |
| 24 } | 26 } |
| 25 | 27 |
| 26 int CallExceptionFilter(EXCEPTION_POINTERS* info) { | 28 int CallExceptionFilter(EXCEPTION_POINTERS* info) { |
| 27 return s_exception_filter ? s_exception_filter(info) : | 29 return s_exception_filter ? s_exception_filter(info) : |
| 28 EXCEPTION_CONTINUE_SEARCH; | 30 EXCEPTION_CONTINUE_SEARCH; |
| 29 } | 31 } |
| 30 | 32 |
| 33 BASE_EXPORT void InitializeWindowClass( |
| 34 WNDCLASSEX* class_out, |
| 35 const char16* class_name, |
| 36 WNDPROC window_proc, |
| 37 UINT style, |
| 38 int class_extra, |
| 39 int window_extra, |
| 40 HCURSOR cursor, |
| 41 HBRUSH background, |
| 42 const char16* menu_name, |
| 43 HICON large_icon, |
| 44 HICON small_icon) { |
| 45 class_out->cbSize = sizeof(WNDCLASSEX); |
| 46 class_out->style = style; |
| 47 class_out->lpfnWndProc = window_proc; |
| 48 class_out->cbClsExtra = class_extra; |
| 49 class_out->cbWndExtra = window_extra; |
| 50 class_out->hInstance = base::GetModuleFromAddress(window_proc); |
| 51 class_out->hIcon = large_icon; |
| 52 class_out->hCursor = cursor; |
| 53 class_out->hbrBackground = background; |
| 54 class_out->lpszMenuName = menu_name; |
| 55 class_out->lpszClassName = class_name; |
| 56 class_out->hIconSm = small_icon; |
| 57 |
| 58 // Check if |window_proc| is valid. |
| 59 DCHECK(class_out->hInstance != NULL); |
| 60 } |
| 61 |
| 31 } // namespace win | 62 } // namespace win |
| 32 } // namespace base | 63 } // namespace base |
| OLD | NEW |