| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef BASE_SCOPED_HANDLE_WIN_H_ | 5 #ifndef BASE_SCOPED_HANDLE_WIN_H_ |
| 6 #define BASE_SCOPED_HANDLE_WIN_H_ | 6 #define BASE_SCOPED_HANDLE_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 void Set(HDC h) { | 124 void Set(HDC h) { |
| 125 Close(); | 125 Close(); |
| 126 hdc_ = h; | 126 hdc_ = h; |
| 127 } | 127 } |
| 128 | 128 |
| 129 operator HDC() { return hdc_; } | 129 operator HDC() { return hdc_; } |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 void Close() { | 132 void Close() { |
| 133 #ifdef NOGDI |
| 134 assert(false); |
| 135 #else |
| 133 if (hdc_) | 136 if (hdc_) |
| 134 DeleteDC(hdc_); | 137 DeleteDC(hdc_); |
| 138 #endif // NOGDI |
| 135 } | 139 } |
| 136 | 140 |
| 137 HDC hdc_; | 141 HDC hdc_; |
| 138 DISALLOW_EVIL_CONSTRUCTORS(ScopedHDC); | 142 DISALLOW_EVIL_CONSTRUCTORS(ScopedHDC); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 // Like ScopedHandle but for GDI objects. | 145 // Like ScopedHandle but for GDI objects. |
| 142 template<class T> | 146 template<class T> |
| 143 class ScopedGDIObject { | 147 class ScopedGDIObject { |
| 144 public: | 148 public: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 private: | 209 private: |
| 206 HGLOBAL glob_; | 210 HGLOBAL glob_; |
| 207 | 211 |
| 208 T* data_; | 212 T* data_; |
| 209 | 213 |
| 210 DISALLOW_EVIL_CONSTRUCTORS(ScopedHGlobal); | 214 DISALLOW_EVIL_CONSTRUCTORS(ScopedHGlobal); |
| 211 }; | 215 }; |
| 212 | 216 |
| 213 #endif // BASE_SCOPED_HANDLE_WIN_H_ | 217 #endif // BASE_SCOPED_HANDLE_WIN_H_ |
| 214 | 218 |
| OLD | NEW |