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

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

Issue 2542183002: Don't remove CSSPreloaderResourceClient for unused speculative markup preloads (Closed)
Patch Set: allow dynamic link preload removal Created 4 years 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 | « third_party/WebKit/LayoutTests/TestExpectations ('k') | 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
7 rights reserved. 7 rights reserved.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 else 747 else
748 m_clients.remove(client); 748 m_clients.remove(client);
749 749
750 if (m_clientsAwaitingCallback.isEmpty()) 750 if (m_clientsAwaitingCallback.isEmpty())
751 ResourceCallback::callbackHandler().cancel(this); 751 ResourceCallback::callbackHandler().cancel(this);
752 752
753 didRemoveClientOrObserver(); 753 didRemoveClientOrObserver();
754 } 754 }
755 755
756 void Resource::didRemoveClientOrObserver() { 756 void Resource::didRemoveClientOrObserver() {
757 if (!hasClientsOrObservers() && m_isAlive) { 757 if (hasClientsOrObservers() || !m_isAlive)
758 m_isAlive = false; 758 return;
759 allClientsAndObserversRemoved();
760 759
761 // RFC2616 14.9.2: 760 // Allow speculative markup preloads to continue even without clients or
762 // "no-store: ... MUST make a best-effort attempt to remove the information 761 // observers. Their lifetime is determined by the ResourceFetcher.
763 // from volatile storage as promptly as possible" 762 if (isUnusedPreload() && !isLinkPreload())
yhirano 2016/12/02 01:32:25 Is it possible to register a ResourceClient instea
Charlie Harrison 2016/12/02 04:20:22 Hm... so the CSSPreloaderResourceClient removes it
yhirano 2016/12/02 08:50:29 Then is it possible to stop removing itself only w
Charlie Harrison 2016/12/02 13:14:15 I think it might be possible now that CSSPreloader
764 // "... History buffers MAY store such responses as part of their normal 763 return;
765 // operation." 764
766 // We allow non-secure content to be reused in history, but we do not allow 765 m_isAlive = false;
767 // secure content to be reused. 766 allClientsAndObserversRemoved();
768 if (hasCacheControlNoStoreHeader() && url().protocolIs("https")) 767
769 memoryCache()->remove(this); 768 // RFC2616 14.9.2:
770 } 769 // "no-store: ... MUST make a best-effort attempt to remove the information
770 // from volatile storage as promptly as possible"
771 // "... History buffers MAY store such responses as part of their normal
772 // operation."
773 // We allow non-secure content to be reused in history, but we do not allow
774 // secure content to be reused.
775 if (hasCacheControlNoStoreHeader() && url().protocolIs("https"))
776 memoryCache()->remove(this);
771 } 777 }
772 778
773 void Resource::allClientsAndObserversRemoved() { 779 void Resource::allClientsAndObserversRemoved() {
774 if (!m_loader) 780 if (!m_loader)
775 return; 781 return;
776 if (!m_cancelTimer.isActive()) 782 if (!m_cancelTimer.isActive())
777 m_cancelTimer.startOneShot(0, BLINK_FROM_HERE); 783 m_cancelTimer.startOneShot(0, BLINK_FROM_HERE);
778 } 784 }
779 785
780 void Resource::cancelTimerFired(TimerBase* timer) { 786 void Resource::cancelTimerFired(TimerBase* timer) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 case Resource::TextTrack: 1105 case Resource::TextTrack:
1100 case Resource::Media: 1106 case Resource::Media:
1101 case Resource::Manifest: 1107 case Resource::Manifest:
1102 return false; 1108 return false;
1103 } 1109 }
1104 NOTREACHED(); 1110 NOTREACHED();
1105 return false; 1111 return false;
1106 } 1112 }
1107 1113
1108 } // namespace blink 1114 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698