Index: base/win/scoped_handle.h |
diff --git a/base/win/scoped_handle.h b/base/win/scoped_handle.h |
index 00063afe3526f9df94d3ca6dbc0da5bb93ca5753..e1e0f5d592ad2e557b32a821b7f0b029c10d63c3 100644 |
--- a/base/win/scoped_handle.h |
+++ b/base/win/scoped_handle.h |
@@ -101,9 +101,7 @@ class GenericScopedHandle { |
Verifier::StopTracking(handle_, this, BASE_WIN_GET_CALLER, |
tracked_objects::GetProgramCounter()); |
- if (!Traits::CloseHandle(handle_)) |
- CHECK(false); |
- |
+ Traits::CloseHandle(handle_); |
handle_ = Traits::NullHandle(); |
} |
} |
@@ -120,9 +118,7 @@ class HandleTraits { |
typedef HANDLE Handle; |
// Closes the handle. |
- static bool CloseHandle(HANDLE handle) { |
- return ::CloseHandle(handle) != FALSE; |
- } |
+ static bool BASE_EXPORT CloseHandle(HANDLE handle); |
// Returns true if the handle value is valid. |
static bool IsHandleValid(HANDLE handle) { |
@@ -168,6 +164,17 @@ class BASE_EXPORT VerifierTraits { |
typedef GenericScopedHandle<HandleTraits, VerifierTraits> ScopedHandle; |
+// This function should be called by the embedder to enable the use of |
+// VerifierTraits at runtime. It has no effect if DummyVerifierTraits is used |
+// for ScopedHandle. |
+void BASE_EXPORT EnableHandleVerifier(); |
+ |
+// This should be called whenever the OS is closing a handle, if extended |
+// verification of improper handle closing is desired. If |handle| is being |
+// tracked by the handle verifier and ScopedHandle is not the one closing it, |
+// a CHECK is generated. |
+void BASE_EXPORT OnHandleBeingClosed(HANDLE handle); |
+ |
} // namespace win |
} // namespace base |