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

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

Issue 2290983003: CSSStyleSheetResource should cache decoded text instead of raw bytes (Closed)
Patch Set: add dcheck Created 4 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
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 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 rights reserved.
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 ResourceFetcher::determineRevalidationPolicy(Resource::Type type, 757 ResourceFetcher::determineRevalidationPolicy(Resource::Type type,
758 const FetchRequest& fetchRequest, 758 const FetchRequest& fetchRequest,
759 Resource* existingResource, 759 Resource* existingResource,
760 bool isStaticData) const { 760 bool isStaticData) const {
761 const ResourceRequest& request = fetchRequest.resourceRequest(); 761 const ResourceRequest& request = fetchRequest.resourceRequest();
762 762
763 if (!existingResource) 763 if (!existingResource)
764 return Load; 764 return Load;
765 765
766 // Checks if the resource has an explicit policy about integrity metadata. 766 // Checks if the resource has an explicit policy about integrity metadata.
767 // Currently only applies to ScriptResources.
768 // 767 //
769 // This is necessary because ScriptResource objects do not keep the raw data 768 // This is necessary because ScriptResource and CSSStyleSheetResource objects
770 // around after the source is accessed once, so if the resource is accessed 769 // do not keep the raw data around after the source is accessed once, so if
771 // from the MemoryCache for a second time, there is no way to redo an 770 // the resource is accessed from the MemoryCache for a second time, there is
772 // integrity check. 771 // no way to redo an integrity check.
773 // 772 //
774 // Thus, Blink implements a scheme where it caches the integrity information 773 // Thus, Blink implements a scheme where it caches the integrity information
775 // for a ScriptResource after the first time it is checked, and if there is 774 // for those resources after the first time it is checked, and if there is
776 // another request for that resource, with the same integrity metadata, Blink 775 // another request for that resource, with the same integrity metadata, Blink
777 // skips the integrity calculation. However, if the integrity metadata is a 776 // skips the integrity calculation. However, if the integrity metadata is a
778 // mismatch, the MemoryCache must be skipped here, and a new request for the 777 // mismatch, the MemoryCache must be skipped here, and a new request for the
779 // resource must be made to get the raw data. This is expected to be an 778 // resource must be made to get the raw data. This is expected to be an
780 // uncommon case, however, as it implies two same-origin requests to the same 779 // uncommon case, however, as it implies two same-origin requests to the same
781 // resource, but with different integrity metadata. 780 // resource, but with different integrity metadata.
782 RecordSriResourceIntegrityMismatchEvent(CheckingForIntegrityMismatch); 781 RecordSriResourceIntegrityMismatchEvent(CheckingForIntegrityMismatch);
783 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) { 782 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) {
784 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch); 783 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch);
785 return Reload; 784 return Reload;
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 visitor->trace(m_context); 1591 visitor->trace(m_context);
1593 visitor->trace(m_archive); 1592 visitor->trace(m_archive);
1594 visitor->trace(m_loaders); 1593 visitor->trace(m_loaders);
1595 visitor->trace(m_nonBlockingLoaders); 1594 visitor->trace(m_nonBlockingLoaders);
1596 visitor->trace(m_documentResources); 1595 visitor->trace(m_documentResources);
1597 visitor->trace(m_preloads); 1596 visitor->trace(m_preloads);
1598 visitor->trace(m_resourceTimingInfoMap); 1597 visitor->trace(m_resourceTimingInfoMap);
1599 } 1598 }
1600 1599
1601 } // namespace blink 1600 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698