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

Unified Diff: base/win/scoped_handle.h

Issue 1977833003: Add a buildflag to use the handle verifier in a per module mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN. Created 4 years, 7 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 6603e681109d6b0d1c342f7e42898d04a4a712fd..782f55dd706bf159942f4e401a584f1e14160949 100644
--- a/base/win/scoped_handle.h
+++ b/base/win/scoped_handle.h
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/move.h"
+#include "base/win/base_features.h"
// TODO(rvargas): remove this with the rest of the verifier.
#if defined(COMPILER_MSVC)
@@ -152,6 +153,7 @@ class DummyVerifierTraits {
DISALLOW_IMPLICIT_CONSTRUCTORS(DummyVerifierTraits);
};
+#if BUILDFLAG(ENABLE_HANDLE_VERIFIER)
// Performs actual run-time tracking.
class BASE_EXPORT VerifierTraits {
public:
@@ -168,6 +170,19 @@ class BASE_EXPORT VerifierTraits {
typedef GenericScopedHandle<HandleTraits, VerifierTraits> ScopedHandle;
+// This testing function returns the module that the ActiveVerifier concrete
+// implementation was instantiated in.
+BASE_EXPORT HMODULE GetHandleVerifierModuleForTesting();
+#else
+typedef GenericScopedHandle<HandleTraits, DummyVerifierTraits> ScopedHandle;
+#endif // BUILDFLAG(ENABLE_HANDLE_VERIFIER)
+
+// 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.
+BASE_EXPORT void OnHandleBeingClosed(HANDLE handle);
+
// This function may be called by the embedder to disable the use of
// VerifierTraits at runtime. It has no effect if DummyVerifierTraits is used
// for ScopedHandle.
@@ -179,10 +194,6 @@ BASE_EXPORT void DisableHandleVerifier();
// a CHECK is generated.
BASE_EXPORT void OnHandleBeingClosed(HANDLE handle);
-// This testing function returns the module that the ActiveVerifier concrete
-// implementation was instantiated in.
-BASE_EXPORT HMODULE GetHandleVerifierModuleForTesting();
-
} // namespace win
} // namespace base
« base/win/BUILD.gn ('K') | « base/win/BUILD.gn ('k') | base/win/scoped_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698