Chromium Code Reviews| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck)) | 91 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck)) |
| 92 return String(); | 92 return String(); |
| 93 | 93 |
| 94 if (!m_decodedSheetText.isNull()) | 94 if (!m_decodedSheetText.isNull()) |
| 95 return m_decodedSheetText; | 95 return m_decodedSheetText; |
| 96 | 96 |
| 97 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory | 97 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory |
| 98 return decodedText(); | 98 return decodedText(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void CSSStyleSheetResource::appendData(const char* data, size_t length) | |
| 102 { | |
| 103 Resource::appendData(data, length); | |
| 104 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); | |
| 105 while (StyleSheetResourceClient* c = w.next()) | |
| 106 c->didAppendData(this); | |
|
kouhei (in TOK)
2016/04/21 06:35:03
I'd prefer if the hook is only called on the first
Charlie Harrison
2016/04/25 15:14:34
Done.
| |
| 107 } | |
| 108 | |
| 101 void CSSStyleSheetResource::checkNotify() | 109 void CSSStyleSheetResource::checkNotify() |
| 102 { | 110 { |
| 103 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify() | 111 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify() |
| 104 if (m_data) | 112 if (m_data) |
| 105 m_decodedSheetText = decodedText(); | 113 m_decodedSheetText = decodedText(); |
| 106 | 114 |
| 107 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); | 115 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); |
| 108 while (StyleSheetResourceClient* c = w.next()) | 116 while (StyleSheetResourceClient* c = w.next()) |
| 109 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this); | 117 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this); |
| 110 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. | 118 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 | 185 |
| 178 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); | 186 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); |
| 179 | 187 |
| 180 // Check if this stylesheet resource didn't conflict with | 188 // Check if this stylesheet resource didn't conflict with |
| 181 // another resource and has indeed been added to the cache. | 189 // another resource and has indeed been added to the cache. |
| 182 if (memoryCache()->contains(this)) | 190 if (memoryCache()->contains(this)) |
| 183 m_parsedStyleSheetCache->addedToMemoryCache(); | 191 m_parsedStyleSheetCache->addedToMemoryCache(); |
| 184 } | 192 } |
| 185 | 193 |
| 186 } // namespace blink | 194 } // namespace blink |
| OLD | NEW |