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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 1829803002: [WeakMemoryCache] Do not lookup MemoryCache when adding resource to Inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@MemoryCache_MakeWeak2d
Patch Set: Rebase. Created 4 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 unified diff | Download patch
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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 908
909 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error) 909 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error)
910 { 910 {
911 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); 911 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource);
912 removeResourceLoader(resource->loader()); 912 removeResourceLoader(resource->loader());
913 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); 913 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource));
914 bool isInternalRequest = resource->options().initiatorInfo.name == FetchInit iatorTypeNames::internal; 914 bool isInternalRequest = resource->options().initiatorInfo.name == FetchInit iatorTypeNames::internal;
915 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); 915 context().dispatchDidFail(resource->identifier(), error, isInternalRequest);
916 } 916 }
917 917
918 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc eResponse& response) 918 void ResourceFetcher::didReceiveResponse(Resource* resource, const ResourceRespo nse& response)
919 { 919 {
920 // If the response is fetched via ServiceWorker, the original URL of the res ponse could be different from the URL of the request. 920 // If the response is fetched via ServiceWorker, the original URL of the res ponse could be different from the URL of the request.
921 // We check the URL not to load the resources which are forbidden by the pag e CSP. 921 // We check the URL not to load the resources which are forbidden by the pag e CSP.
922 // https://w3c.github.io/webappsec-csp/#should-block-response 922 // https://w3c.github.io/webappsec-csp/#should-block-response
923 if (response.wasFetchedViaServiceWorker()) { 923 if (response.wasFetchedViaServiceWorker()) {
924 const KURL& originalURL = response.originalURLViaServiceWorker(); 924 const KURL& originalURL = response.originalURLViaServiceWorker();
925 if (!originalURL.isEmpty() && !context().allowResponse(resource->getType (), resource->resourceRequest(), originalURL, resource->options())) { 925 if (!originalURL.isEmpty() && !context().allowResponse(resource->getType (), resource->resourceRequest(), originalURL, resource->options())) {
926 resource->loader()->cancel(); 926 resource->loader()->cancel();
927 bool isInternalRequest = resource->options().initiatorInfo.name == F etchInitiatorTypeNames::internal; 927 bool isInternalRequest = resource->options().initiatorInfo.name == F etchInitiatorTypeNames::internal;
928 context().dispatchDidFail(resource->identifier(), ResourceError(erro rDomainBlinkInternal, 0, originalURL.getString(), "Unsafe attempt to load URL " + originalURL.elidedString() + " fetched by a ServiceWorker."), isInternalReques t); 928 context().dispatchDidFail(resource->identifier(), ResourceError(erro rDomainBlinkInternal, 0, originalURL.getString(), "Unsafe attempt to load URL " + originalURL.elidedString() + " fetched by a ServiceWorker."), isInternalReques t);
929 return; 929 return;
930 } 930 }
931 } 931 }
932 context().dispatchDidReceiveResponse(resource->identifier(), response, resou rce->resourceRequest().frameType(), resource->resourceRequest().requestContext() , resource->loader()); 932 context().dispatchDidReceiveResponse(resource->identifier(), response, resou rce->resourceRequest().frameType(), resource->resourceRequest().requestContext() , resource);
933 } 933 }
934 934
935 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data, int dataLength, int encodedDataLength) 935 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data, int dataLength, int encodedDataLength)
936 { 936 {
937 context().dispatchDidReceiveData(resource->identifier(), data, dataLength, e ncodedDataLength); 937 context().dispatchDidReceiveData(resource->identifier(), data, dataLength, e ncodedDataLength);
938 } 938 }
939 939
940 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength, int encodedDataLength) 940 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength, int encodedDataLength)
941 { 941 {
942 context().dispatchDidDownloadData(resource->identifier(), dataLength, encode dDataLength); 942 context().dispatchDidDownloadData(resource->identifier(), dataLength, encode dDataLength);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 visitor->trace(m_context); 1174 visitor->trace(m_context);
1175 visitor->trace(m_archive); 1175 visitor->trace(m_archive);
1176 visitor->trace(m_loaders); 1176 visitor->trace(m_loaders);
1177 visitor->trace(m_nonBlockingLoaders); 1177 visitor->trace(m_nonBlockingLoaders);
1178 visitor->trace(m_documentResources); 1178 visitor->trace(m_documentResources);
1179 visitor->trace(m_preloads); 1179 visitor->trace(m_preloads);
1180 visitor->trace(m_resourceTimingInfoMap); 1180 visitor->trace(m_resourceTimingInfoMap);
1181 } 1181 }
1182 1182
1183 } // namespace blink 1183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698