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

Unified Diff: base/win/scoped_handle.cc

Issue 1767293005: Add creation tracking for ActiveVerifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | no next file » | 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 f358c99b6f011073f19706c1643a8529e7c54b75..8739ea7887ba0b39339f504d5f54600f4961a085 100644
--- a/base/win/scoped_handle.cc
+++ b/base/win/scoped_handle.cc
@@ -95,6 +95,7 @@ class ActiveVerifier {
static void InstallVerifier();
+ base::debug::StackTrace creation_stack_;
bool enabled_;
bool closing_;
NativeLock* lock_;
@@ -168,6 +169,7 @@ void ActiveVerifier::StartTracking(HANDLE handle, const void* owner,
if (!result.second) {
Info other = result.first->second;
base::debug::Alias(&other);
+ base::debug::Alias(&creation_stack_);
CHECK(false); // Attempt to start tracking already tracked handle.
}
}
@@ -179,12 +181,15 @@ void ActiveVerifier::StopTracking(HANDLE handle, const void* owner,
AutoNativeLock lock(*lock_);
HandleMap::iterator i = map_.find(handle);
- if (i == map_.end())
+ if (i == map_.end()) {
+ base::debug::Alias(&creation_stack_);
CHECK(false); // Attempting to close an untracked handle.
+ }
Info other = i->second;
if (other.owner != owner) {
base::debug::Alias(&other);
+ base::debug::Alias(&creation_stack_);
CHECK(false); // Attempting to close a handle not owned by opener.
}
@@ -209,6 +214,7 @@ void ActiveVerifier::OnHandleBeingClosed(HANDLE handle) {
Info other = i->second;
base::debug::Alias(&other);
+ base::debug::Alias(&creation_stack_);
CHECK(false); // CloseHandle called on tracked handle.
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698