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, 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 ResourceClientWalker<ScriptResourceClient> walker(m_clients); | 70 ResourceClientWalker<ScriptResourceClient> walker(m_clients); |
| 71 while (ScriptResourceClient* client = walker.next()) | 71 while (ScriptResourceClient* client = walker.next()) |
| 72 client->notifyAppendData(this); | 72 client->notifyAppendData(this); |
| 73 } | 73 } |
| 74 | 74 |
| 75 AtomicString ScriptResource::mimeType() const | 75 AtomicString ScriptResource::mimeType() const |
| 76 { | 76 { |
| 77 return extractMIMETypeFromMediaType(m_response.httpHeaderField("Content-Type ")).lower(); | 77 return extractMIMETypeFromMediaType(m_response.httpHeaderField("Content-Type ")).lower(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 const String& ScriptResource::script() | 80 RefPtrWillBeRawPtr<CompressableString> ScriptResource::script() |
|
haraken
2015/10/22 16:03:31
RefPtrWillBeRawPtr<CompressableString> => Compress
hajimehoshi
2015/10/26 09:34:02
Done.
| |
| 81 { | 81 { |
| 82 ASSERT(!isPurgeable()); | 82 ASSERT(!isPurgeable()); |
| 83 ASSERT(isLoaded()); | 83 ASSERT(isLoaded()); |
| 84 | 84 |
| 85 if (!m_script && m_data) { | 85 if (!m_script && m_data) { |
| 86 String script = decodedText(); | 86 String script = decodedText(); |
| 87 m_data.clear(); | 87 m_data.clear(); |
| 88 // We lie a it here and claim that script counts as encoded data (even t hough it's really decoded data). | 88 // We lie a it here and claim that script counts as encoded data (even t hough it's really decoded data). |
| 89 // That's because the MemoryCache thinks that it can clear out decoded d ata by calling destroyDecodedData(), | 89 // That's because the MemoryCache thinks that it can clear out decoded d ata by calling destroyDecodedData(), |
| 90 // but we can't destroy script in destroyDecodedData because that's our only copy of the data! | 90 // but we can't destroy script in destroyDecodedData because that's our only copy of the data! |
| 91 setEncodedSize(script.sizeInBytes()); | 91 setEncodedSize(script.sizeInBytes()); |
| 92 m_script = AtomicString(script); | 92 m_script = CompressableString::create(script); |
| 93 } | 93 } |
| 94 | 94 |
| 95 return m_script.string(); | 95 return m_script; |
|
haraken
2015/10/22 16:03:31
return m_script.get();
hajimehoshi
2015/10/26 09:34:02
Done.
| |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool ScriptResource::mimeTypeAllowedByNosniff() const | 98 bool ScriptResource::mimeTypeAllowedByNosniff() const |
| 99 { | 99 { |
| 100 return parseContentTypeOptionsHeader(m_response.httpHeaderField("X-Content-T ype-Options")) != ContentTypeOptionsNosniff || MIMETypeRegistry::isSupportedJava ScriptMIMEType(mimeType()); | 100 return parseContentTypeOptionsHeader(m_response.httpHeaderField("X-Content-T ype-Options")) != ContentTypeOptionsNosniff || MIMETypeRegistry::isSupportedJava ScriptMIMEType(mimeType()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque st) const | 103 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque st) const |
| 104 { | 104 { |
| 105 if (request.integrityMetadata().isEmpty()) | 105 if (request.integrityMetadata().isEmpty()) |
| 106 return false; | 106 return false; |
| 107 | 107 |
| 108 // TODO(jww) this integrity metadata should actually be | 108 // TODO(jww) this integrity metadata should actually be |
| 109 // normalized so that order doesn't matter. | 109 // normalized so that order doesn't matter. |
| 110 return m_integrityMetadata != request.integrityMetadata(); | 110 return m_integrityMetadata != request.integrityMetadata(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |