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

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

Issue 653813002: Fetcher: Use ResourceFetcher::isControlledByServiceWorker for cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 ASSERT(policy != Use || m_documentLoader->substituteData().isValid()); 784 ASSERT(policy != Use || m_documentLoader->substituteData().isValid());
785 ASSERT(policy != Revalidate); 785 ASSERT(policy != Revalidate);
786 memoryCache()->remove(resource.get()); 786 memoryCache()->remove(resource.get());
787 } else { 787 } else {
788 // Remove a resource to be handled by Service Worker from the cache to 788 // Remove a resource to be handled by Service Worker from the cache to
789 // prevent reuse because Service Worker can serve an arbitrary resource 789 // prevent reuse because Service Worker can serve an arbitrary resource
790 // for an URL and pollute a memory cache entry. 790 // for an URL and pollute a memory cache entry.
791 // FIXME: isControlledByServiceWorker() always returns false on main 791 // FIXME: isControlledByServiceWorker() always returns false on main
792 // resource request, but main resource is always removed from the cache 792 // resource request, but main resource is always removed from the cache
793 // as the above comment (http://crbug.com/388375). 793 // as the above comment (http://crbug.com/388375).
794 if (frame() && m_documentLoader && frame()->loader().client()->isControl ledByServiceWorker(*m_documentLoader)) { 794 if (isControlledByServiceWorker()) {
795 ASSERT(policy == Load || policy == Reload); 795 ASSERT(policy == Load || policy == Reload);
796 memoryCache()->remove(resource.get()); 796 memoryCache()->remove(resource.get());
797 } 797 }
798 } 798 }
799 799
800 requestLoadStarted(resource.get(), request, policy == Use ? ResourceLoadingF romCache : ResourceLoadingFromNetwork); 800 requestLoadStarted(resource.get(), request, policy == Use ? ResourceLoadingF romCache : ResourceLoadingFromNetwork);
801 801
802 ASSERT(resource->url() == url.string()); 802 ASSERT(resource->url() == url.string());
803 m_documentResources.set(resource->url(), resource); 803 m_documentResources.set(resource->url(), resource);
804 return resource; 804 return resource;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 948
949 ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy (Resource::Type type, const FetchRequest& fetchRequest, Resource* existingResour ce) const 949 ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy (Resource::Type type, const FetchRequest& fetchRequest, Resource* existingResour ce) const
950 { 950 {
951 const ResourceRequest& request = fetchRequest.resourceRequest(); 951 const ResourceRequest& request = fetchRequest.resourceRequest();
952 952
953 if (!existingResource) 953 if (!existingResource)
954 return Load; 954 return Load;
955 955
956 // FIXME: Currently caching for a resource to be handled by Service Worker 956 // FIXME: Currently caching for a resource to be handled by Service Worker
957 // is disabled (http://crbug.com/388375). 957 // is disabled (http://crbug.com/388375).
958 if (frame() && m_documentLoader && frame()->loader().client()->isControlledB yServiceWorker(*m_documentLoader)) 958 if (isControlledByServiceWorker())
959 return Reload; 959 return Reload;
960 960
961 // We already have a preload going for this URL. 961 // We already have a preload going for this URL.
962 if (fetchRequest.forPreload() && existingResource->isPreloaded()) 962 if (fetchRequest.forPreload() && existingResource->isPreloaded())
963 return Use; 963 return Use;
964 964
965 // If the same URL has been loaded as a different type, we need to reload. 965 // If the same URL has been loaded as a different type, we need to reload.
966 if (existingResource->type() != type) { 966 if (existingResource->type() != type) {
967 // FIXME: If existingResource is a Preload and the new type is LinkPrefe tch 967 // FIXME: If existingResource is a Preload and the new type is LinkPrefe tch
968 // We really should discard the new prefetch since the preload has more 968 // We really should discard the new prefetch since the preload has more
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 1553
1554 void ResourceFetcher::trace(Visitor* visitor) 1554 void ResourceFetcher::trace(Visitor* visitor)
1555 { 1555 {
1556 visitor->trace(m_document); 1556 visitor->trace(m_document);
1557 visitor->trace(m_loaders); 1557 visitor->trace(m_loaders);
1558 visitor->trace(m_multipartLoaders); 1558 visitor->trace(m_multipartLoaders);
1559 ResourceLoaderHost::trace(visitor); 1559 ResourceLoaderHost::trace(visitor);
1560 } 1560 }
1561 1561
1562 } 1562 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698