OLD | NEW |
---|---|
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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 | 756 |
757 // FIXME: Temporarily leave main resource caching disabled for chromium, | 757 // FIXME: Temporarily leave main resource caching disabled for chromium, |
758 // see https://bugs.webkit.org/show_bug.cgi?id=107962. Before caching main | 758 // see https://bugs.webkit.org/show_bug.cgi?id=107962. Before caching main |
759 // resources, we should be sure to understand the implications for memory | 759 // resources, we should be sure to understand the implications for memory |
760 // use. | 760 // use. |
761 // Remove main resource from cache to prevent reuse. | 761 // Remove main resource from cache to prevent reuse. |
762 if (type == Resource::MainResource) { | 762 if (type == Resource::MainResource) { |
763 ASSERT(policy != Use || m_documentLoader->substituteData().isValid()); | 763 ASSERT(policy != Use || m_documentLoader->substituteData().isValid()); |
764 ASSERT(policy != Revalidate); | 764 ASSERT(policy != Revalidate); |
765 memoryCache()->remove(resource.get()); | 765 memoryCache()->remove(resource.get()); |
766 } else { | |
767 // Remove a resource to be handled by Service Worker from the cache to | |
768 // prevent reuse because Service Worker can serve an arbitrary resource | |
769 // for an URL and pollute a memory cache entry. | |
770 // FIXME: isControlledByServiceWorker() always returns false on main | |
771 // resource request, but main resource is always removed from the cache | |
772 // as the above comment (http://crbug.com/388375). | |
773 if (frame() && frame()->loader().client()->isControlledByServiceWorker() ) { | |
michaeln
2014/10/09 00:35:26
ouch, this is gonna hurt performance
nhiroki
2014/10/09 02:34:15
Yes, that's a sore point of this change. I'm going
dominicc (has gone to gerrit)
2014/10/09 02:45:24
Actually... why don't we land this as-is and concu
| |
774 ASSERT(policy == Load || policy == Reload); | |
775 memoryCache()->remove(resource.get()); | |
776 } | |
766 } | 777 } |
767 | 778 |
768 requestLoadStarted(resource.get(), request, policy == Use ? ResourceLoadingF romCache : ResourceLoadingFromNetwork); | 779 requestLoadStarted(resource.get(), request, policy == Use ? ResourceLoadingF romCache : ResourceLoadingFromNetwork); |
769 | 780 |
770 ASSERT(resource->url() == url.string()); | 781 ASSERT(resource->url() == url.string()); |
771 m_documentResources.set(resource->url(), resource); | 782 m_documentResources.set(resource->url(), resource); |
772 return resource; | 783 return resource; |
773 } | 784 } |
774 | 785 |
775 void ResourceFetcher::resourceTimingReportTimerFired(Timer<ResourceFetcher>* tim er) | 786 void ResourceFetcher::resourceTimingReportTimerFired(Timer<ResourceFetcher>* tim er) |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 } | 925 } |
915 } | 926 } |
916 | 927 |
917 ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy (Resource::Type type, const FetchRequest& fetchRequest, Resource* existingResour ce) const | 928 ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy (Resource::Type type, const FetchRequest& fetchRequest, Resource* existingResour ce) const |
918 { | 929 { |
919 const ResourceRequest& request = fetchRequest.resourceRequest(); | 930 const ResourceRequest& request = fetchRequest.resourceRequest(); |
920 | 931 |
921 if (!existingResource) | 932 if (!existingResource) |
922 return Load; | 933 return Load; |
923 | 934 |
935 // FIXME: Currently caching for a resource to be handled by Service Worker | |
936 // is disabled (http://crbug.com/388375). | |
937 if (frame() && frame()->loader().client()->isControlledByServiceWorker()) | |
938 return Reload; | |
939 | |
924 // We already have a preload going for this URL. | 940 // We already have a preload going for this URL. |
925 if (fetchRequest.forPreload() && existingResource->isPreloaded()) | 941 if (fetchRequest.forPreload() && existingResource->isPreloaded()) |
926 return Use; | 942 return Use; |
927 | 943 |
928 // If the same URL has been loaded as a different type, we need to reload. | 944 // If the same URL has been loaded as a different type, we need to reload. |
929 if (existingResource->type() != type) { | 945 if (existingResource->type() != type) { |
930 // FIXME: If existingResource is a Preload and the new type is LinkPrefe tch | 946 // FIXME: If existingResource is a Preload and the new type is LinkPrefe tch |
931 // We really should discard the new prefetch since the preload has more | 947 // We really should discard the new prefetch since the preload has more |
932 // specific type information! crbug.com/379893 | 948 // specific type information! crbug.com/379893 |
933 // fast/dom/HTMLLinkElement/link-and-subresource-test hits this case. | 949 // fast/dom/HTMLLinkElement/link-and-subresource-test hits this case. |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1516 | 1532 |
1517 void ResourceFetcher::trace(Visitor* visitor) | 1533 void ResourceFetcher::trace(Visitor* visitor) |
1518 { | 1534 { |
1519 visitor->trace(m_document); | 1535 visitor->trace(m_document); |
1520 visitor->trace(m_loaders); | 1536 visitor->trace(m_loaders); |
1521 visitor->trace(m_multipartLoaders); | 1537 visitor->trace(m_multipartLoaders); |
1522 ResourceLoaderHost::trace(visitor); | 1538 ResourceLoaderHost::trace(visitor); |
1523 } | 1539 } |
1524 | 1540 |
1525 } | 1541 } |
OLD | NEW |