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

Side by Side Diff: trunk/Source/core/loader/cache/CachedResourceLoader.cpp

Issue 16603005: Revert 152077 "[Resource Timing] Expose redirect timing information" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "core/loader/cache/CachedResourceRequest.h" 50 #include "core/loader/cache/CachedResourceRequest.h"
51 #include "core/loader/cache/CachedScript.h" 51 #include "core/loader/cache/CachedScript.h"
52 #include "core/loader/cache/CachedShader.h" 52 #include "core/loader/cache/CachedShader.h"
53 #include "core/loader/cache/CachedXSLStyleSheet.h" 53 #include "core/loader/cache/CachedXSLStyleSheet.h"
54 #include "core/loader/cache/MemoryCache.h" 54 #include "core/loader/cache/MemoryCache.h"
55 #include "core/page/Console.h" 55 #include "core/page/Console.h"
56 #include "core/page/ContentSecurityPolicy.h" 56 #include "core/page/ContentSecurityPolicy.h"
57 #include "core/page/DOMWindow.h" 57 #include "core/page/DOMWindow.h"
58 #include "core/page/Frame.h" 58 #include "core/page/Frame.h"
59 #include "core/page/Performance.h" 59 #include "core/page/Performance.h"
60 #include "core/page/ResourceTimingInfo.h"
61 #include "core/page/Settings.h" 60 #include "core/page/Settings.h"
62 #include "core/platform/Logging.h" 61 #include "core/platform/Logging.h"
63 #include "weborigin/SecurityOrigin.h" 62 #include "weborigin/SecurityOrigin.h"
64 #include "weborigin/SecurityPolicy.h" 63 #include "weborigin/SecurityPolicy.h"
65 64
66 #include "core/loader/cache/CachedTextTrack.h" 65 #include "core/loader/cache/CachedTextTrack.h"
67 66
68 #define PRELOAD_DEBUG 0 67 #define PRELOAD_DEBUG 0
69 68
70 namespace WebCore { 69 namespace WebCore {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 addAdditionalRequestHeaders(request.mutableResourceRequest(), type); 627 addAdditionalRequestHeaders(request.mutableResourceRequest(), type);
629 CachedResourceHandle<CachedResource> resource = createResource(type, request .mutableResourceRequest(), charset); 628 CachedResourceHandle<CachedResource> resource = createResource(type, request .mutableResourceRequest(), charset);
630 629
631 memoryCache()->add(resource.get()); 630 memoryCache()->add(resource.get());
632 storeResourceTimingInitiatorInformation(resource, request); 631 storeResourceTimingInitiatorInformation(resource, request);
633 return resource; 632 return resource;
634 } 633 }
635 634
636 void CachedResourceLoader::storeResourceTimingInitiatorInformation(const CachedR esourceHandle<CachedResource>& resource, const CachedResourceRequest& request) 635 void CachedResourceLoader::storeResourceTimingInitiatorInformation(const CachedR esourceHandle<CachedResource>& resource, const CachedResourceRequest& request)
637 { 636 {
638 RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.options ().initiatorInfo.name, monotonicallyIncreasingTime()); 637 CachedResourceInitiatorInfo info = request.options().initiatorInfo;
638 info.startTime = monotonicallyIncreasingTime();
639 639
640 if (resource->type() == CachedResource::MainResource) { 640 if (resource->type() == CachedResource::MainResource) {
641 // <iframe>s should report the initial navigation requested by the paren t document, but not subsequent navigations. 641 // <iframe>s should report the initial navigation requested by the paren t document, but not subsequent navigations.
642 if (frame()->ownerElement() && !frame()->ownerElement()->loadedNonEmptyD ocument()) { 642 if (frame()->ownerElement() && !frame()->ownerElement()->loadedNonEmptyD ocument()) {
643 info->setInitiatorType(frame()->ownerElement()->localName()); 643 info.name = frame()->ownerElement()->localName();
644 m_resourceTimingInfoMap.add(resource.get(), info); 644 m_initiatorMap.add(resource.get(), info);
645 frame()->ownerElement()->didLoadNonEmptyDocument(); 645 frame()->ownerElement()->didLoadNonEmptyDocument();
646 } 646 }
647 } else { 647 } else {
648 m_resourceTimingInfoMap.add(resource.get(), info); 648 m_initiatorMap.add(resource.get(), info);
649 } 649 }
650 } 650 }
651 651
652 CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida tionPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) con st 652 CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida tionPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) con st
653 { 653 {
654 if (!existingResource) 654 if (!existingResource)
655 return Load; 655 return Load;
656 656
657 // We already have a preload going for this URL. 657 // We already have a preload going for this URL.
658 if (forPreload && existingResource->isPreloaded()) 658 if (forPreload && existingResource->isPreloaded())
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 return CachePolicyVerify; 810 return CachePolicyVerify;
811 811
812 if (type != CachedResource::MainResource) 812 if (type != CachedResource::MainResource)
813 return frame()->loader()->subresourceCachePolicy(); 813 return frame()->loader()->subresourceCachePolicy();
814 814
815 if (frame()->loader()->loadType() == FrameLoadTypeReloadFromOrigin || frame( )->loader()->loadType() == FrameLoadTypeReload) 815 if (frame()->loader()->loadType() == FrameLoadTypeReloadFromOrigin || frame( )->loader()->loadType() == FrameLoadTypeReload)
816 return CachePolicyReload; 816 return CachePolicyReload;
817 return CachePolicyVerify; 817 return CachePolicyVerify;
818 } 818 }
819 819
820 void CachedResourceLoader::redirectReceived(CachedResource* resource, const Reso urceResponse& redirectResponse)
821 {
822 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource);
823 if (it != m_resourceTimingInfoMap.end())
824 it->value->addRedirect(redirectResponse);
825 }
826
827 void CachedResourceLoader::loadDone(CachedResource* resource) 820 void CachedResourceLoader::loadDone(CachedResource* resource)
828 { 821 {
829 RefPtr<DocumentLoader> protectDocumentLoader(m_documentLoader); 822 RefPtr<DocumentLoader> protectDocumentLoader(m_documentLoader);
830 RefPtr<Document> protectDocument(m_document); 823 RefPtr<Document> protectDocument(m_document);
831 824
832 if (resource && resource->response().isHTTP() && ((!resource->errorOccurred( ) && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) { 825 if (resource && resource->response().isHTTP() && ((!resource->errorOccurred( ) && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) {
833 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour ce); 826 HashMap<CachedResource*, CachedResourceInitiatorInfo>::iterator initiato rIt = m_initiatorMap.find(resource);
834 if (it != m_resourceTimingInfoMap.end()) { 827 if (initiatorIt != m_initiatorMap.end()) {
835 ASSERT(document()); 828 ASSERT(document());
836 Document* initiatorDocument = document(); 829 Document* initiatorDocument = document();
837 if (resource->type() == CachedResource::MainResource) 830 if (resource->type() == CachedResource::MainResource)
838 initiatorDocument = document()->parentDocument(); 831 initiatorDocument = document()->parentDocument();
839 ASSERT(initiatorDocument); 832 ASSERT(initiatorDocument);
840 RefPtr<ResourceTimingInfo> info = it->value; 833 const CachedResourceInitiatorInfo& info = initiatorIt->value;
841 info->setInitialRequest(resource->resourceRequest()); 834 initiatorDocument->domWindow()->performance()->addResourceTiming(inf o.name, initiatorDocument, resource->resourceRequest(), resource->response(), in fo.startTime, resource->loadFinishTime());
842 info->setFinalResponse(resource->response()); 835 m_initiatorMap.remove(initiatorIt);
843 info->setLoadFinishTime(resource->loadFinishTime());
844 initiatorDocument->domWindow()->performance()->addResourceTiming(*in fo, initiatorDocument);
845 m_resourceTimingInfoMap.remove(it);
846 } 836 }
847 } 837 }
848 838
849 if (frame()) 839 if (frame())
850 frame()->loader()->loadDone(); 840 frame()->loader()->loadDone();
851 performPostLoadActions(); 841 performPostLoadActions();
852 842
853 if (!m_garbageCollectDocumentResourcesTimer.isActive()) 843 if (!m_garbageCollectDocumentResourcesTimer.isActive())
854 m_garbageCollectDocumentResourcesTimer.startOneShot(0); 844 m_garbageCollectDocumentResourcesTimer.startOneShot(0);
855 } 845 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 info.addMember(m_garbageCollectDocumentResourcesTimer, "garbageCollectDocume ntResourcesTimer"); 1062 info.addMember(m_garbageCollectDocumentResourcesTimer, "garbageCollectDocume ntResourcesTimer");
1073 } 1063 }
1074 1064
1075 const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions( ) 1065 const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions( )
1076 { 1066 {
1077 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy)); 1067 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy));
1078 return options; 1068 return options;
1079 } 1069 }
1080 1070
1081 } 1071 }
OLDNEW
« no previous file with comments | « trunk/Source/core/loader/cache/CachedResourceLoader.h ('k') | trunk/Source/core/page/Performance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698