OLD | NEW |
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 Loading... |
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 |
OLD | NEW |