Add asserts to verify correct DOM object usage.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@192 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-02-23 14:56:10 +00:00
parent 60736ac4e0
commit 6ca5cff06c
2 changed files with 12 additions and 0 deletions

View File

@ -255,6 +255,14 @@ void CefDOMDocumentImpl::Detach()
if (!VerifyContext())
return;
// If you hit this assert it means that you are keeping references to node
// objects beyond the valid scope.
DCHECK(node_map_.empty());
// If you hit this assert it means that you are keeping references to this
// document object beyond the valid scope.
DCHECK(GetRefCt() == 1);
if (!node_map_.empty()) {
NodeMap::const_iterator it = node_map_.begin();
for (; it != node_map_.end(); ++it)

View File

@ -147,6 +147,10 @@ CefRefPtr<CefDOMNode> CefDOMEventImpl::GetCurrentTarget()
void CefDOMEventImpl::Detach()
{
// If you hit this assert it means that you are keeping references to this
// event object beyond the valid scope.
DCHECK(GetRefCt() == 1);
document_ = NULL;
event_.assign(WebDOMEvent());
}