|
Lines 44-49
a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec1
|
| 44 |
#include "FrameLoader.h" |
44 |
#include "FrameLoader.h" |
| 45 |
#include "FrameLoaderClient.h" |
45 |
#include "FrameLoaderClient.h" |
| 46 |
#include "HTMLElement.h" |
46 |
#include "HTMLElement.h" |
|
|
47 |
#include "HTMLFrameOwnerElement.h" |
| 47 |
#include "LoaderStrategy.h" |
48 |
#include "LoaderStrategy.h" |
| 48 |
#include "Logging.h" |
49 |
#include "Logging.h" |
| 49 |
#include "MemoryCache.h" |
50 |
#include "MemoryCache.h" |
|
Lines 527-536
CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(co
a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec2
|
| 527 |
memoryCache()->remove(resource); |
528 |
memoryCache()->remove(resource); |
| 528 |
memoryCache()->add(newResource.get()); |
529 |
memoryCache()->add(newResource.get()); |
| 529 |
#if ENABLE(RESOURCE_TIMING) |
530 |
#if ENABLE(RESOURCE_TIMING) |
| 530 |
if (resource->type() != CachedResource::MainResource) { |
531 |
storeResourceTimingInitiatorInformation(resource, request); |
| 531 |
InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() }; |
|
|
| 532 |
m_initiatorMap.add(newResource.get(), info); |
| 533 |
} |
| 534 |
#else |
532 |
#else |
| 535 |
UNUSED_PARAM(request); |
533 |
UNUSED_PARAM(request); |
| 536 |
#endif |
534 |
#endif |
|
Lines 548-560
CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedRe
a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec3
|
| 548 |
if (!memoryCache()->add(resource.get())) |
546 |
if (!memoryCache()->add(resource.get())) |
| 549 |
resource->setOwningCachedResourceLoader(this); |
547 |
resource->setOwningCachedResourceLoader(this); |
| 550 |
#if ENABLE(RESOURCE_TIMING) |
548 |
#if ENABLE(RESOURCE_TIMING) |
| 551 |
if (type != CachedResource::MainResource) { |
549 |
storeResourceTimingInitiatorInformation(resource, request); |
|
|
550 |
#endif |
| 551 |
return resource; |
| 552 |
} |
| 553 |
|
| 554 |
#if ENABLE(RESOURCE_TIMING) |
| 555 |
void CachedResourceLoader::storeResourceTimingInitiatorInformation(const CachedResourceHandle<CachedResource>& resource, const CachedResourceRequest& request) |
| 556 |
{ |
| 557 |
if (resource->type() == CachedResource::MainResource) { |
| 558 |
// <iframe>s should report the initial navigation requested by the parent document, but not subsequent navigations. |
| 559 |
if (frame()->ownerElement() && m_documentLoader->frameLoader()->stateMachine()->committingFirstRealLoad()) { |
| 560 |
InitiatorInfo info = { frame()->ownerElement()->localName(), monotonicallyIncreasingTime() }; |
| 561 |
m_initiatorMap.add(resource.get(), info); |
| 562 |
} |
| 563 |
} else { |
| 552 |
InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() }; |
564 |
InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() }; |
| 553 |
m_initiatorMap.add(resource.get(), info); |
565 |
m_initiatorMap.add(resource.get(), info); |
| 554 |
} |
566 |
} |
| 555 |
#endif |
|
|
| 556 |
return resource; |
| 557 |
} |
567 |
} |
|
|
568 |
#endif // ENABLE(RESOURCE_TIMING) |
| 558 |
|
569 |
|
| 559 |
CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) const |
570 |
CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) const |
| 560 |
{ |
571 |
{ |
|
Lines 740-752
void CachedResourceLoader::loadDone(CachedResource* resource)
a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec4
|
| 740 |
RefPtr<Document> protectDocument(m_document); |
751 |
RefPtr<Document> protectDocument(m_document); |
| 741 |
|
752 |
|
| 742 |
#if ENABLE(RESOURCE_TIMING) |
753 |
#if ENABLE(RESOURCE_TIMING) |
| 743 |
// FIXME: Add resource timing support for main resources. |
754 |
if (resource && resource->response().isHTTP() && ((!resource->errorOccurred() && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) { |
| 744 |
if (resource && resource->type() != CachedResource::MainResource && resource->response().isHTTP() && ((!resource->errorOccurred() && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) { |
|
|
| 745 |
HashMap<CachedResource*, InitiatorInfo>::iterator initiatorIt = m_initiatorMap.find(resource); |
755 |
HashMap<CachedResource*, InitiatorInfo>::iterator initiatorIt = m_initiatorMap.find(resource); |
| 746 |
if (initiatorIt != m_initiatorMap.end()) { |
756 |
if (initiatorIt != m_initiatorMap.end()) { |
| 747 |
ASSERT(document()); |
757 |
ASSERT(document()); |
|
|
758 |
Document* initiatorDocument = document(); |
| 759 |
if (resource->type() == CachedResource::MainResource) |
| 760 |
initiatorDocument = document()->parentDocument(); |
| 761 |
ASSERT(initiatorDocument); |
| 748 |
const InitiatorInfo& info = initiatorIt->value; |
762 |
const InitiatorInfo& info = initiatorIt->value; |
| 749 |
document()->domWindow()->performance()->addResourceTiming(info.name, document(), resource->resourceRequest(), resource->response(), info.startTime, resource->loadFinishTime()); |
763 |
initiatorDocument->domWindow()->performance()->addResourceTiming(info.name, initiatorDocument, resource->resourceRequest(), resource->response(), info.startTime, resource->loadFinishTime()); |
| 750 |
m_initiatorMap.remove(initiatorIt); |
764 |
m_initiatorMap.remove(initiatorIt); |
| 751 |
} |
765 |
} |
| 752 |
} |
766 |
} |