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

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

Issue 1802123002: Unify Resource loading status tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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 84635b3de28d012ade6b6391ef9251da28d2eb72..05d2e40fe2157788c6ad2efc14896d529ca11ebd 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -159,10 +159,8 @@ Resource::Resource(const ResourceRequest& request, Type type, const ResourceLoad
, m_preloadCount(0)
, m_cacheIdentifier(MemoryCache::defaultCacheIdentifier())
, m_preloadResult(PreloadNotReferenced)
- , m_requestedFromNetworkingLayer(false)
- , m_loading(false)
, m_type(type)
- , m_status(Pending)
+ , m_status(NotStarted)
, m_needsSynchronousCacheHit(false)
, m_linkPreload(false)
{
@@ -203,7 +201,6 @@ DEFINE_TRACE(Resource)
void Resource::load(ResourceFetcher* fetcher)
{
RELEASE_ASSERT(!m_loader);
- m_loading = true;
m_status = Pending;
ResourceRequest& request(m_revalidatingRequest.isNull() ? m_resourceRequest : m_revalidatingRequest);
@@ -291,8 +288,6 @@ void Resource::error(Resource::Status status)
setStatus(status);
ASSERT(errorOccurred());
m_data.clear();
-
- setLoading(false);
checkNotify();
markClientsFinished();
}
@@ -300,11 +295,10 @@ void Resource::error(Resource::Status status)
void Resource::finish()
{
ASSERT(m_revalidatingRequest.isNull());
- setLoading(false);
- checkNotify();
- markClientsFinished();
if (!errorOccurred())
m_status = Cached;
+ checkNotify();
+ markClientsFinished();
}
AtomicString Resource::httpContentType() const
@@ -422,7 +416,6 @@ void Resource::willFollowRedirect(ResourceRequest& newRequest, const ResourceRes
{
newRequest.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredCredentials);
m_redirectChain.append(RedirectPair(newRequest, redirectResponse));
- m_requestedFromNetworkingLayer = true;
}
bool Resource::unlock()
@@ -560,7 +553,7 @@ void Resource::clearLoader()
void Resource::didAddClient(ResourceClient* c)
{
- if (!isLoading() && !stillNeedsLoad()) {
+ if (isLoaded()) {
c->notifyFinished(this);
if (m_clients.contains(c)) {
m_finishedClients.add(c);
@@ -595,7 +588,7 @@ void Resource::addClient(ResourceClient* client)
if (m_preloadResult == PreloadNotReferenced) {
if (isLoaded())
m_preloadResult = PreloadReferencedWhileComplete;
- else if (m_requestedFromNetworkingLayer)
+ else if (isLoading())
m_preloadResult = PreloadReferencedWhileLoading;
else
m_preloadResult = PreloadReferenced;
@@ -673,8 +666,7 @@ void Resource::cancelTimerFired(Timer<Resource>* timer)
return;
RefPtrWillBeRawPtr<Resource> protect(this);
m_loader->cancelIfNotFinishing();
- if (m_status != Cached)
- memoryCache()->remove(this);
+ memoryCache()->remove(this);
}
void Resource::setDecodedSize(size_t decodedSize)
@@ -865,7 +857,7 @@ bool Resource::mustRevalidateDueToCacheHeaders()
bool Resource::canUseCacheValidator()
{
- if (m_loading || errorOccurred())
+ if (isLoading() || errorOccurred())
return false;
if (hasCacheControlNoStoreHeader())

Powered by Google App Engine
This is Rietveld 408576698