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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 2394793002: Resource: helper class to prohibit {add,remove}Client() calls in scope (Closed)
Patch Set: rebase Created 4 years, 2 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: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 913456b738b345dbedfcfe55123d214acbcd177b..d0de8259a3b53162531e2bb2d529296f5f0cf925 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -316,6 +316,7 @@ Resource::Resource(const ResourceRequest& request,
m_isRevalidating(false),
m_isAlive(false),
m_integrityDisposition(ResourceIntegrityDisposition::NotChecked),
+ m_isAddRemoveClientProhibited(false),
m_options(options),
m_responseTimestamp(currentTime()),
m_cancelTimer(this, &Resource::cancelTimerFired),
@@ -707,6 +708,8 @@ void Resource::willAddClientOrObserver(PreloadReferencePolicy policy) {
void Resource::addClient(ResourceClient* client,
PreloadReferencePolicy policy) {
+ CHECK(!m_isAddRemoveClientProhibited);
+
willAddClientOrObserver(policy);
if (m_isRevalidating) {
@@ -730,6 +733,8 @@ void Resource::addClient(ResourceClient* client,
}
void Resource::removeClient(ResourceClient* client) {
+ CHECK(!m_isAddRemoveClientProhibited);
+
// This code may be called in a pre-finalizer, where weak members in the
// HashCountedSet are already swept out.
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698