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

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

Issue 243533002: Fix aggressive RELEASE_ASSERTs in Resource (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix debug build Created 6 years, 8 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: Source/core/fetch/Resource.cpp
diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
index e4096b63282f3c1579f9ff0e637c25deb02f6444..628032ce7d8208d159093ce9344f288c62079011 100644
--- a/Source/core/fetch/Resource.cpp
+++ b/Source/core/fetch/Resource.cpp
@@ -478,14 +478,15 @@ void Resource::removeClient(ResourceClient* client)
if (m_clientsAwaitingCallback.contains(client)) {
ASSERT(!m_clients.contains(client));
m_clientsAwaitingCallback.remove(client);
- if (m_clientsAwaitingCallback.isEmpty())
- ResourceCallback::callbackHandler()->cancel(this);
} else {
- RELEASE_ASSERT(m_clients.contains(client));
+ ASSERT(m_clients.contains(client));
m_clients.remove(client);
didRemoveClient(client);
}
+ if (m_clientsAwaitingCallback.isEmpty())
+ ResourceCallback::callbackHandler()->cancel(this);
+
bool deleted = deleteIfPossible();
if (!deleted && !hasClients()) {
memoryCache()->makeDead(this);
@@ -588,10 +589,11 @@ void Resource::finishPendingClients()
didAddClient(client);
}
+ // It is still possible for the above loop to finish a new client synchronously.
+ // If there's no client waiting we should deschedule.
bool scheduled = ResourceCallback::callbackHandler()->isScheduled(this);
- // It is a critical problem if a callback is scheduled but there is no client waiting for it.
- // Such a callback cannot be cancelled. It is better to crash the renderer now.
- RELEASE_ASSERT(!scheduled || !m_clientsAwaitingCallback.isEmpty());
+ if (scheduled && m_clientsAwaitingCallback.isEmpty())
+ ResourceCallback::callbackHandler()->cancel(this);
// Prevent the case when there are clients waiting but no callback scheduled.
ASSERT(m_clientsAwaitingCallback.isEmpty() || scheduled);
« 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