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

Unified Diff: base/win/scoped_handle.cc

Issue 1779333003: Add test for multithreaded ActiveVerifier behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@handlecreate
Patch Set: change to loadable_module Created 4 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
« no previous file with comments | « base/win/scoped_handle.h ('k') | base/win/scoped_handle_test_dll.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/scoped_handle.cc
diff --git a/base/win/scoped_handle.cc b/base/win/scoped_handle.cc
index 99dae66e3b2cc1610ea54c9d9e24750446b0566b..7fa8b4380913d4aed8e0b927fb8c0a3d2d82c22d 100644
--- a/base/win/scoped_handle.cc
+++ b/base/win/scoped_handle.cc
@@ -22,6 +22,9 @@ __declspec(dllexport) void* GetHandleVerifier();
typedef void* (*GetHandleVerifierFn)();
}
+// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
+extern "C" IMAGE_DOS_HEADER __ImageBase;
+
namespace {
struct HandleHash {
@@ -85,6 +88,7 @@ class ActiveVerifier {
const void* pc1, const void* pc2);
virtual void Disable();
virtual void OnHandleBeingClosed(HANDLE handle);
+ virtual HMODULE GetModule() const;
private:
~ActiveVerifier(); // Not implemented.
@@ -242,6 +246,10 @@ void ActiveVerifier::OnHandleBeingClosed(HANDLE handle) {
CHECK(false); // CloseHandle called on tracked handle.
}
+HMODULE ActiveVerifier::GetModule() const {
+ return reinterpret_cast<HMODULE>(&__ImageBase);
+}
+
} // namespace
void* GetHandleVerifier() {
@@ -276,5 +284,9 @@ void OnHandleBeingClosed(HANDLE handle) {
return ActiveVerifier::Get()->OnHandleBeingClosed(handle);
}
+HMODULE GetHandleVerifierModuleForTesting() {
+ return g_active_verifier->GetModule();
+}
+
} // namespace win
} // namespace base
« no previous file with comments | « base/win/scoped_handle.h ('k') | base/win/scoped_handle_test_dll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698