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

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

Issue 1961173003: Corrected assert for cacheable stylesheets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 StyleSheetContents* CSSStyleSheetResource::restoreParsedStyleSheet(const CSSPars erContext& context) 152 StyleSheetContents* CSSStyleSheetResource::restoreParsedStyleSheet(const CSSPars erContext& context)
153 { 153 {
154 if (!m_parsedStyleSheetCache) 154 if (!m_parsedStyleSheetCache)
155 return nullptr; 155 return nullptr;
156 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) { 156 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) {
157 setParsedStyleSheetCache(nullptr); 157 setParsedStyleSheetCache(nullptr);
158 return nullptr; 158 return nullptr;
159 } 159 }
160 160
161 ASSERT(m_parsedStyleSheetCache->isCacheable()); 161 ASSERT(m_parsedStyleSheetCache->isCacheableForResource());
162 ASSERT(m_parsedStyleSheetCache->isReferencedFromResource()); 162 ASSERT(m_parsedStyleSheetCache->isReferencedFromResource());
163 163
164 // Contexts must be identical so we know we would get the same exact result if we parsed again. 164 // Contexts must be identical so we know we would get the same exact result if we parsed again.
165 if (m_parsedStyleSheetCache->parserContext() != context) 165 if (m_parsedStyleSheetCache->parserContext() != context)
166 return nullptr; 166 return nullptr;
167 167
168 didAccessDecodedData(); 168 didAccessDecodedData();
169 169
170 return m_parsedStyleSheetCache; 170 return m_parsedStyleSheetCache;
171 } 171 }
172 172
173 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet) 173 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet)
174 { 174 {
175 ASSERT(sheet && sheet->isCacheable()); 175 ASSERT(sheet && sheet->isCacheableForResource());
176 176
177 if (!memoryCache()->contains(this)) { 177 if (!memoryCache()->contains(this)) {
178 // This stylesheet resource did conflict with another resource and was 178 // This stylesheet resource did conflict with another resource and was
179 // not added to the cache. 179 // not added to the cache.
180 setParsedStyleSheetCache(nullptr); 180 setParsedStyleSheetCache(nullptr);
181 return; 181 return;
182 } 182 }
183 setParsedStyleSheetCache(sheet); 183 setParsedStyleSheetCache(sheet);
184 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 184 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
185 } 185 }
186 186
187 } // namespace blink 187 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | third_party/WebKit/Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698