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

Unified Diff: base/win/scoped_handle.h

Issue 9700038: ScopedProcessInformation protects against process/thread handle leaks from CreateProcess calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to comments. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
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) {
alexeypa (please no reviews) 2012/03/15 16:38:27 const Handle& handle
erikwright (departed) 2012/03/15 18:02:44 Done.
- 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) {
+ return lhs == rhs;
+ }
+
// Returns NULL handle value.
static HANDLE NullHandle() {
return NULL;

Powered by Google App Engine
This is Rietveld 408576698