| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (hasValidMIMEType) | 144 if (hasValidMIMEType) |
| 145 *hasValidMIMEType = typeOK; | 145 *hasValidMIMEType = typeOK; |
| 146 if (!enforceMIMEType) | 146 if (!enforceMIMEType) |
| 147 return true; | 147 return true; |
| 148 return typeOK; | 148 return typeOK; |
| 149 } | 149 } |
| 150 | 150 |
| 151 PassRefPtrWillBeRawPtr<StyleSheetContents> CSSStyleSheetResource::restoreParsedS
tyleSheet(const CSSParserContext& context) | 151 PassRefPtrWillBeRawPtr<StyleSheetContents> CSSStyleSheetResource::restoreParsedS
tyleSheet(const CSSParserContext& context) |
| 152 { | 152 { |
| 153 if (!m_parsedStyleSheetCache) | 153 if (!m_parsedStyleSheetCache) |
| 154 return 0; | 154 return nullptr; |
| 155 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) { | 155 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) { |
| 156 m_parsedStyleSheetCache->removedFromMemoryCache(); | 156 m_parsedStyleSheetCache->removedFromMemoryCache(); |
| 157 m_parsedStyleSheetCache.clear(); | 157 m_parsedStyleSheetCache.clear(); |
| 158 return 0; | 158 return nullptr; |
| 159 } | 159 } |
| 160 | 160 |
| 161 ASSERT(m_parsedStyleSheetCache->isCacheable()); | 161 ASSERT(m_parsedStyleSheetCache->isCacheable()); |
| 162 ASSERT(m_parsedStyleSheetCache->isInMemoryCache()); | 162 ASSERT(m_parsedStyleSheetCache->isInMemoryCache()); |
| 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 0; | 166 return nullptr; |
| 167 | 167 |
| 168 didAccessDecodedData(currentTime()); | 168 didAccessDecodedData(currentTime()); |
| 169 | 169 |
| 170 return m_parsedStyleSheetCache; | 170 return m_parsedStyleSheetCache; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void CSSStyleSheetResource::saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleShe
etContents> sheet) | 173 void CSSStyleSheetResource::saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleShe
etContents> sheet) |
| 174 { | 174 { |
| 175 ASSERT(sheet && sheet->isCacheable()); | 175 ASSERT(sheet && sheet->isCacheable()); |
| 176 | 176 |
| 177 if (m_parsedStyleSheetCache) | 177 if (m_parsedStyleSheetCache) |
| 178 m_parsedStyleSheetCache->removedFromMemoryCache(); | 178 m_parsedStyleSheetCache->removedFromMemoryCache(); |
| 179 m_parsedStyleSheetCache = sheet; | 179 m_parsedStyleSheetCache = sheet; |
| 180 m_parsedStyleSheetCache->addedToMemoryCache(); | 180 m_parsedStyleSheetCache->addedToMemoryCache(); |
| 181 | 181 |
| 182 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); | 182 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } | 185 } |
| OLD | NEW |