Chromium Code Reviews| Index: base/win/scoped_handle.h |
| diff --git a/base/win/scoped_handle.h b/base/win/scoped_handle.h |
| index b89219c45ee3c8fdd6f9a07b3de1ad3b831d9129..d42a5bd64061f137b51f9e38ccd79d4be44e3ebf 100644 |
| --- a/base/win/scoped_handle.h |
| +++ b/base/win/scoped_handle.h |
| @@ -41,7 +41,7 @@ class GenericScopedHandle { |
| } |
| void Set(Handle handle) { |
| - if (handle_ != handle) { |
| + if (!Traits::IsSame(handle_, handle)) { |
| Close(); |
| if (Traits::IsHandleValid(handle)) { |
| @@ -101,6 +101,11 @@ class HandleTraits { |
| return handle != NULL && handle != INVALID_HANDLE_VALUE; |
| } |
| + // Returns true if the handle values are the same. |
| + static bool IsSame(HANDLE lhs, HANDLE rhs) { |
|
alexeypa (please no reviews)
2012/03/15 02:41:31
We will be able to avoid changing all instances of
erikwright (departed)
2012/03/15 03:29:17
I thought about listing this as one of my proposed
|
| + return lhs == rhs; |
| + } |
| + |
| // Returns NULL handle value. |
| static HANDLE NullHandle() { |
| return NULL; |