DescriptionIntroduce ContentBrowserSanityChecker, which currently just adds checks to
validate the sanity of the WebContentsObserver invocations, but which hopefully
will grow to include other too-heavy-for-production-code bug detection logic.
The currently supported check, WebContentsObserverSanityChecker, is a fleshed-
out version of the FrameLifetimeConsistencyChecker previously used in
RenderFrameHost unittests.
This sanity check managed to identify the root cause for bug 438951, so it's
already proved itself useful. Enabling it on all tests should prevent future
regressions of that kind.
To install this on all WebContentses, we need to un-deprecate the
WebContentsImpl::AddCreatedCallback/RemoveCreatedCallback mechanism. To make
that safer, the dangerous methods are moved to the FriendZone (get it?) which is
what I call what Dr. Dobbs calls, stodgily, the "C++ attorney/client idiom"
http://goo.gl/13oS7e. They also now have, cleverly, ForTesting in their names.
Lastly, we change the invocation time of the g_created_callbacks to be at the
end of WebContents::Init, instead of at the end of the ctor, so we're not
inviting tests to muck around with a half-inflated WebContents.
BUG=438951, 444722, 444717
TBR=jochen@chromium.org
Committed: https://crrev.com/f9acfbeeed26e7cd71b4fd0d7fa1754dd80140d5
Cr-Commit-Position: refs/heads/master@{#309571}
Patch Set 1 #Patch Set 2 : Productionize the consistency checker, install it everywhere. #Patch Set 3 : Self-review fixes #Patch Set 4 : Newlines at eof, apparently #Patch Set 5 : Move controversial methods to the FriendZone #Patch Set 6 : Jiggle the comments. #
Total comments: 2
Patch Set 7 : Disable a test, take Avi's fixes. #Patch Set 8 : Add a link to bug 444722 #Patch Set 9 : Add semicolon. #Messages
Total messages: 25 (9 generated)
|