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

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

Issue 2231523002: Make ResourceFetcher return Resources with LoadError instead of nullptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, resolve comment rewrap conflicts. 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 932a38e5481f5917c7368b44d0b1b5394b12628c..79a9db08045f768b9b21e680e7c13e3ce01007cb 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -645,7 +645,7 @@ void Resource::didAddClient(ResourceClient* c) {
}
}
-static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type) {
+static bool typeNeedsSynchronousCacheHit(Resource::Type type) {
// Some resources types default to return data synchronously. For most of
// these, it's because there are layout tests that expect data to return
// synchronously in case of cache hit. In the case of fonts, there was a
@@ -695,11 +695,10 @@ void Resource::addClient(ResourceClient* client,
return;
}
- // If we have existing data to send to the new client and the resource type
- // supprts it, send it asynchronously.
- if (!m_response.isNull() &&
- !shouldSendCachedDataSynchronouslyForType(getType()) &&
- !m_needsSynchronousCacheHit) {
+ // If an error has occurred or we have existing data to send to the new client
+ // and the resource type supprts it, send it asynchronously.
+ if ((errorOccurred() || !m_response.isNull()) &&
+ !typeNeedsSynchronousCacheHit(getType()) && !m_needsSynchronousCacheHit) {
m_clientsAwaitingCallback.add(client);
ResourceCallback::callbackHandler().schedule(this);
return;

Powered by Google App Engine
This is Rietveld 408576698