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

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: 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 2f31ccdcf511baaefd669bfbc6c789223d69428f..8bd7d64800e99597db1e03ccd947c856ab66723c 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -313,6 +313,7 @@ Resource::Resource(const ResourceRequest& request,
m_linkPreload(false),
m_isRevalidating(false),
m_isAlive(false),
+ m_isAddRemoveClientProhibited(false),
m_options(options),
m_responseTimestamp(currentTime()),
m_cancelTimer(this, &Resource::cancelTimerFired),
@@ -687,6 +688,8 @@ void Resource::willAddClientOrObserver(PreloadReferencePolicy policy) {
void Resource::addClient(ResourceClient* client,
PreloadReferencePolicy policy) {
+ CHECK(!m_isAddRemoveClientProhibited);
+
willAddClientOrObserver(policy);
if (m_isRevalidating) {
@@ -710,6 +713,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.

Powered by Google App Engine
This is Rietveld 408576698