|
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-533
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 |
if (resource->type() == CachedResource::MainResource) { |
|
|
532 |
if (frame()->ownerElement() && m_documentLoader->frameLoader()->stateMachine()->committingFirstRealLoad()) { |
| 533 |
InitiatorInfo info = { frame()->ownerElement()->localName(), monotonicallyIncreasingTime() }; |
| 534 |
m_initiatorMap.add(newResource.get(), info); |
| 535 |
} |
| 536 |
} else { |
| 531 |
InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() }; |
537 |
InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() }; |
| 532 |
m_initiatorMap.add(newResource.get(), info); |
538 |
m_initiatorMap.add(newResource.get(), info); |
| 533 |
} |
539 |
} |
|
Lines 548-554
CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedRe
a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec3
|
| 548 |
if (!memoryCache()->add(resource.get())) |
554 |
if (!memoryCache()->add(resource.get())) |
| 549 |
resource->setOwningCachedResourceLoader(this); |
555 |
resource->setOwningCachedResourceLoader(this); |
| 550 |
#if ENABLE(RESOURCE_TIMING) |
556 |
#if ENABLE(RESOURCE_TIMING) |
| 551 |
if (type != CachedResource::MainResource) { |
557 |
if (type == CachedResource::MainResource) { |
|
|
558 |
if (frame()->ownerElement() && m_documentLoader->frameLoader()->stateMachine()->committingFirstRealLoad()) { |
| 559 |
InitiatorInfo info = { frame()->ownerElement()->localName(), monotonicallyIncreasingTime() }; |
| 560 |
m_initiatorMap.add(resource.get(), info); |
| 561 |
} |
| 562 |
} else { |
| 552 |
InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() }; |
563 |
InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() }; |
| 553 |
m_initiatorMap.add(resource.get(), info); |
564 |
m_initiatorMap.add(resource.get(), info); |
| 554 |
} |
565 |
} |
|
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 |
} |