| 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, 2007, 2008 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (!m_script && m_data) { | 75 if (!m_script && m_data) { |
| 76 m_script = m_decoder->decode(m_data->data(), encodedSize()); | 76 m_script = m_decoder->decode(m_data->data(), encodedSize()); |
| 77 m_script.append(m_decoder->flush()); | 77 m_script.append(m_decoder->flush()); |
| 78 setDecodedSize(m_script.sizeInBytes()); | 78 setDecodedSize(m_script.sizeInBytes()); |
| 79 } | 79 } |
| 80 m_decodedDataDeletionTimer.startOneShot(0); | 80 m_decodedDataDeletionTimer.startOneShot(0); |
| 81 | 81 |
| 82 return m_script; | 82 return m_script; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void CachedScript::data(PassRefPtr<ResourceBuffer> data, bool allDataReceived) | |
| 86 { | |
| 87 if (!allDataReceived) | |
| 88 return; | |
| 89 | |
| 90 m_data = data; | |
| 91 setEncodedSize(m_data.get() ? m_data->size() : 0); | |
| 92 setLoading(false); | |
| 93 checkNotify(); | |
| 94 } | |
| 95 | |
| 96 void CachedScript::destroyDecodedData() | 85 void CachedScript::destroyDecodedData() |
| 97 { | 86 { |
| 98 m_script = String(); | 87 m_script = String(); |
| 99 setDecodedSize(0); | 88 setDecodedSize(0); |
| 100 if (!MemoryCache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePur
geable()) | 89 if (!MemoryCache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePur
geable()) |
| 101 makePurgeable(true); | 90 makePurgeable(true); |
| 102 } | 91 } |
| 103 | 92 |
| 104 bool CachedScript::mimeTypeAllowedByNosniff() const | 93 bool CachedScript::mimeTypeAllowedByNosniff() const |
| 105 { | 94 { |
| 106 return !parseContentTypeOptionsHeader(m_response.httpHeaderField("X-Content-
Type-Options")) == ContentTypeOptionsNosniff || MIMETypeRegistry::isSupportedJav
aScriptMIMEType(mimeType()); | 95 return !parseContentTypeOptionsHeader(m_response.httpHeaderField("X-Content-
Type-Options")) == ContentTypeOptionsNosniff || MIMETypeRegistry::isSupportedJav
aScriptMIMEType(mimeType()); |
| 107 } | 96 } |
| 108 | 97 |
| 109 void CachedScript::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 98 void CachedScript::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
| 110 { | 99 { |
| 111 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou
rceScript); | 100 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou
rceScript); |
| 112 CachedResource::reportMemoryUsage(memoryObjectInfo); | 101 CachedResource::reportMemoryUsage(memoryObjectInfo); |
| 113 info.addMember(m_script, "script"); | 102 info.addMember(m_script, "script"); |
| 114 info.addMember(m_decoder, "decoder"); | 103 info.addMember(m_decoder, "decoder"); |
| 115 } | 104 } |
| 116 | 105 |
| 117 } // namespace WebCore | 106 } // namespace WebCore |
| OLD | NEW |