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

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

Issue 1941733002: Don't cache parsed stylesheet if it wasn't added to the memory cache. (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
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp ('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 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 return m_parsedStyleSheetCache; 179 return m_parsedStyleSheetCache;
180 } 180 }
181 181
182 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet) 182 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet)
183 { 183 {
184 ASSERT(sheet && sheet->isCacheable()); 184 ASSERT(sheet && sheet->isCacheable());
185 185
186 if (m_parsedStyleSheetCache) 186 if (m_parsedStyleSheetCache)
187 m_parsedStyleSheetCache->removedFromMemoryCache(); 187 m_parsedStyleSheetCache->removedFromMemoryCache();
188
189 if (!memoryCache()->contains(this)) {
190 // This stylesheet resource did conflict with another resource and was
191 // not added to the cache.
192 m_parsedStyleSheetCache = nullptr;
193 return;
194 }
188 m_parsedStyleSheetCache = sheet; 195 m_parsedStyleSheetCache = sheet;
196 m_parsedStyleSheetCache->addedToMemoryCache();
189 197
190 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 198 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
191
192 // Check if this stylesheet resource didn't conflict with
193 // another resource and has indeed been added to the cache.
194 if (memoryCache()->contains(this))
195 m_parsedStyleSheetCache->addedToMemoryCache();
196 } 199 }
197 200
198 } // namespace blink 201 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698