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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 6 | 6 |
| 7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
| 8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
| 9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
| 10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 This class provides all functionality needed for loading images, style sheet s and html | 22 This class provides all functionality needed for loading images, style sheet s and html |
| 23 pages from the web. It has a memory cache for these objects. | 23 pages from the web. It has a memory cache for these objects. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef ScriptResource_h | 26 #ifndef ScriptResource_h |
| 27 #define ScriptResource_h | 27 #define ScriptResource_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/fetch/ResourceClient.h" | 30 #include "core/fetch/ResourceClient.h" |
| 31 #include "core/fetch/TextResource.h" | 31 #include "core/fetch/TextResource.h" |
| 32 #include "wtf/text/CompressableString.h" | |
| 32 | 33 |
| 33 namespace blink { | 34 namespace blink { |
| 34 | 35 |
| 35 class FetchRequest; | 36 class FetchRequest; |
| 36 class ScriptResource; | 37 class ScriptResource; |
| 37 | 38 |
| 38 class CORE_EXPORT ScriptResourceClient : public ResourceClient { | 39 class CORE_EXPORT ScriptResourceClient : public ResourceClient { |
| 39 public: | 40 public: |
| 40 ~ScriptResourceClient() override {} | 41 ~ScriptResourceClient() override {} |
| 41 static ResourceClientType expectedType() { return ScriptType; } | 42 static ResourceClientType expectedType() { return ScriptType; } |
| 42 ResourceClientType resourceClientType() const final { return expectedType(); } | 43 ResourceClientType resourceClientType() const final { return expectedType(); } |
| 43 | 44 |
| 44 virtual void notifyAppendData(ScriptResource* resource) { } | 45 virtual void notifyAppendData(ScriptResource* resource) { } |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 class CORE_EXPORT ScriptResource final : public TextResource { | 48 class CORE_EXPORT ScriptResource final : public TextResource { |
| 48 public: | 49 public: |
| 49 typedef ScriptResourceClient ClientType; | 50 typedef ScriptResourceClient ClientType; |
| 50 static ResourcePtr<ScriptResource> fetch(FetchRequest&, ResourceFetcher*); | 51 static ResourcePtr<ScriptResource> fetch(FetchRequest&, ResourceFetcher*); |
| 51 | 52 |
| 52 // Public for testing | 53 // Public for testing |
| 53 ScriptResource(const ResourceRequest&, const String& charset); | 54 ScriptResource(const ResourceRequest&, const String& charset); |
| 54 | 55 |
| 55 ~ScriptResource() override; | 56 ~ScriptResource() override; |
| 56 | 57 |
| 57 void didAddClient(ResourceClient*) override; | 58 void didAddClient(ResourceClient*) override; |
| 58 void appendData(const char*, unsigned) override; | 59 void appendData(const char*, unsigned) override; |
| 59 | 60 |
| 60 const String& script(); | 61 RefPtrWillBeRawPtr<CompressableString> script(); |
|
esprehn
2015/10/24 03:59:25
not a ref ptr
| |
| 61 | 62 |
| 62 AtomicString mimeType() const; | 63 AtomicString mimeType() const; |
| 63 | 64 |
| 64 bool mimeTypeAllowedByNosniff() const; | 65 bool mimeTypeAllowedByNosniff() const; |
| 65 | 66 |
| 66 void setIntegrityMetadata(const String& metadata) { m_integrityMetadata = me tadata; } | 67 void setIntegrityMetadata(const String& metadata) { m_integrityMetadata = me tadata; } |
| 67 String integrityMetadata() const { return m_integrityMetadata; } | 68 String integrityMetadata() const { return m_integrityMetadata; } |
| 68 void setIntegrityAlreadyChecked(bool checked) { m_integrityChecked = checked ; } | 69 void setIntegrityAlreadyChecked(bool checked) { m_integrityChecked = checked ; } |
| 69 bool integrityAlreadyChecked() { return m_integrityChecked; } | 70 bool integrityAlreadyChecked() { return m_integrityChecked; } |
| 70 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const override; | 71 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const override; |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 class ScriptResourceFactory : public ResourceFactory { | 74 class ScriptResourceFactory : public ResourceFactory { |
| 74 public: | 75 public: |
| 75 ScriptResourceFactory() | 76 ScriptResourceFactory() |
| 76 : ResourceFactory(Resource::Script) { } | 77 : ResourceFactory(Resource::Script) { } |
| 77 | 78 |
| 78 Resource* create(const ResourceRequest& request, const String& charset) const override | 79 Resource* create(const ResourceRequest& request, const String& charset) const override |
| 79 { | 80 { |
| 80 return new ScriptResource(request, charset); | 81 return new ScriptResource(request, charset); |
| 81 } | 82 } |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 bool m_integrityChecked; | 85 bool m_integrityChecked; |
| 85 String m_integrityMetadata; | 86 String m_integrityMetadata; |
| 86 | 87 |
| 87 AtomicString m_script; | 88 RefPtrWillBeMember<CompressableString> m_script; |
|
esprehn
2015/10/24 03:59:25
By making these not atomic strings you lose the de
| |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 DEFINE_RESOURCE_TYPE_CASTS(Script); | 91 DEFINE_RESOURCE_TYPE_CASTS(Script); |
| 91 | 92 |
| 92 } | 93 } |
| 93 | 94 |
| 94 #endif | 95 #endif |
| OLD | NEW |