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

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

Issue 2411243004: [WeakMemoryCache] Remove LRU lists, prune order control and live/dead distinction (Closed)
Patch Set: Reflect yhirano's comment Created 4 years, 1 month 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 DCHECK(m_parsedStyleSheetCache->isCacheableForResource()); 197 DCHECK(m_parsedStyleSheetCache->isCacheableForResource());
198 DCHECK(m_parsedStyleSheetCache->isReferencedFromResource()); 198 DCHECK(m_parsedStyleSheetCache->isReferencedFromResource());
199 199
200 // Contexts must be identical so we know we would get the same exact result if 200 // Contexts must be identical so we know we would get the same exact result if
201 // we parsed again. 201 // we parsed again.
202 if (m_parsedStyleSheetCache->parserContext() != context) 202 if (m_parsedStyleSheetCache->parserContext() != context)
203 return nullptr; 203 return nullptr;
204 204
205 didAccessDecodedData();
206
207 return m_parsedStyleSheetCache; 205 return m_parsedStyleSheetCache;
208 } 206 }
209 207
210 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet) { 208 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet) {
211 DCHECK(sheet); 209 DCHECK(sheet);
212 DCHECK(sheet->isCacheableForResource()); 210 DCHECK(sheet->isCacheableForResource());
213 211
214 if (!memoryCache()->contains(this)) { 212 if (!memoryCache()->contains(this)) {
215 // This stylesheet resource did conflict with another resource and was not 213 // This stylesheet resource did conflict with another resource and was not
216 // added to the cache. 214 // added to the cache.
(...skipping 10 matching lines...) Expand all
227 } 225 }
228 226
229 void CSSStyleSheetResource::updateDecodedSize() { 227 void CSSStyleSheetResource::updateDecodedSize() {
230 size_t decodedSize = m_decodedSheetText.charactersSizeInBytes(); 228 size_t decodedSize = m_decodedSheetText.charactersSizeInBytes();
231 if (m_parsedStyleSheetCache) 229 if (m_parsedStyleSheetCache)
232 decodedSize += m_parsedStyleSheetCache->estimatedSizeInBytes(); 230 decodedSize += m_parsedStyleSheetCache->estimatedSizeInBytes();
233 setDecodedSize(decodedSize); 231 setDecodedSize(decodedSize);
234 } 232 }
235 233
236 } // namespace blink 234 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698