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

Unified Diff: Source/core/loader/cache/CachedResourceLoader.cpp

Issue 14672042: Prepare to add more initiator info to CachedResource(Request) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Restore performance reporting logic. Created 7 years, 7 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 | « Source/core/loader/cache/CachedResourceLoader.h ('k') | Source/core/loader/cache/CachedResourceRequest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/cache/CachedResourceLoader.cpp
diff --git a/Source/core/loader/cache/CachedResourceLoader.cpp b/Source/core/loader/cache/CachedResourceLoader.cpp
index 3b17400c14d297570415ab8648c69ea3b97a650e..f55121fb8729f6ec0f0629596cb677220598bf85 100644
--- a/Source/core/loader/cache/CachedResourceLoader.cpp
+++ b/Source/core/loader/cache/CachedResourceLoader.cpp
@@ -569,17 +569,17 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedRe
void CachedResourceLoader::storeResourceTimingInitiatorInformation(const CachedResourceHandle<CachedResource>& resource, const CachedResourceRequest& request)
{
- if (resource->type() == CachedResource::MainResource) {
+ CachedResourceInitiatorInfo info = request.initiatorInfo();
+ info.startTime = monotonicallyIncreasingTime();
+ if ((resource->type() == CachedResource::MainResource) && frame()->ownerElement()) {
+ info.name = frame()->ownerElement()->localName();
// <iframe>s should report the initial navigation requested by the parent document, but not subsequent navigations.
- if (frame()->ownerElement() && !frame()->ownerElement()->loadedNonEmptyDocument()) {
- InitiatorInfo info = { frame()->ownerElement()->localName(), monotonicallyIncreasingTime() };
- m_initiatorMap.add(resource.get(), info);
+ if (!frame()->ownerElement()->loadedNonEmptyDocument()) {
+ info.isInitialFrameLoad = true;
frame()->ownerElement()->didLoadNonEmptyDocument();
}
- } else {
- InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() };
- m_initiatorMap.add(resource.get(), info);
}
+ resource->setInitiatorInfo(info);
James Simonsen 2013/05/16 13:28:54 The initiator info is different depending on which
eustas 2013/05/16 14:26:54 I see that CachedResource initiatorInfo is set onc
}
CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) const
@@ -766,16 +766,15 @@ void CachedResourceLoader::loadDone(CachedResource* resource)
RefPtr<Document> protectDocument(m_document);
if (resource && resource->response().isHTTP() && ((!resource->errorOccurred() && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) {
- HashMap<CachedResource*, InitiatorInfo>::iterator initiatorIt = m_initiatorMap.find(resource);
- if (initiatorIt != m_initiatorMap.end()) {
+ const CachedResourceInitiatorInfo& info = resource->initiatorInfo();
+ bool isMainResource = resource->type() == CachedResource::MainResource;
+ if ((resource->type() != CachedResource::MainResource) || info.isInitialFrameLoad) {
ASSERT(document());
Document* initiatorDocument = document();
- if (resource->type() == CachedResource::MainResource)
+ if (info.isInitialFrameLoad)
initiatorDocument = document()->parentDocument();
ASSERT(initiatorDocument);
- const InitiatorInfo& info = initiatorIt->value;
initiatorDocument->domWindow()->performance()->addResourceTiming(info.name, initiatorDocument, resource->resourceRequest(), resource->response(), info.startTime, resource->loadFinishTime());
- m_initiatorMap.remove(initiatorIt);
}
}
@@ -1008,8 +1007,6 @@ void CachedResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
info.addMember(m_preloads, "preloads");
info.addMember(m_pendingPreloads, "pendingPreloads");
info.addMember(m_garbageCollectDocumentResourcesTimer, "garbageCollectDocumentResourcesTimer");
- // FIXME: m_initiatorMap has pointers to already deleted CachedResources
- info.ignoreMember(m_initiatorMap);
}
const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions()
« no previous file with comments | « Source/core/loader/cache/CachedResourceLoader.h ('k') | Source/core/loader/cache/CachedResourceRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698