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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ~ScriptResourceClient() override {} | 42 ~ScriptResourceClient() override {} |
43 static ResourceClientType expectedType() { return ScriptType; } | 43 static ResourceClientType expectedType() { return ScriptType; } |
44 ResourceClientType resourceClientType() const final { return expectedType();
} | 44 ResourceClientType resourceClientType() const final { return expectedType();
} |
45 | 45 |
46 virtual void notifyAppendData(ScriptResource* resource) { } | 46 virtual void notifyAppendData(ScriptResource* resource) { } |
47 }; | 47 }; |
48 | 48 |
49 class CORE_EXPORT ScriptResource final : public TextResource { | 49 class CORE_EXPORT ScriptResource final : public TextResource { |
50 public: | 50 public: |
51 using ClientType = ScriptResourceClient; | 51 using ClientType = ScriptResourceClient; |
52 static ResourcePtr<ScriptResource> fetch(FetchRequest&, ResourceFetcher*); | 52 static PassRefPtrWillBeRawPtr<ScriptResource> fetch(FetchRequest&, ResourceF
etcher*); |
53 | 53 |
54 // Public for testing | 54 // Public for testing |
55 ScriptResource(const ResourceRequest&, const String& charset); | 55 static PassRefPtrWillBeRawPtr<ScriptResource> create(const ResourceRequest&
request, const String& charset) |
| 56 { |
| 57 return adoptRefWillBeNoop(new ScriptResource(request, charset)); |
| 58 } |
56 | 59 |
57 ~ScriptResource() override; | 60 ~ScriptResource() override; |
58 | 61 |
59 void didAddClient(ResourceClient*) override; | 62 void didAddClient(ResourceClient*) override; |
60 void appendData(const char*, size_t) override; | 63 void appendData(const char*, size_t) override; |
61 | 64 |
62 void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) const o
verride; | 65 void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) const o
verride; |
63 | 66 |
64 void destroyDecodedDataForFailedRevalidation() override; | 67 void destroyDecodedDataForFailedRevalidation() override; |
65 | 68 |
66 const CompressibleString& script(); | 69 const CompressibleString& script(); |
67 | 70 |
68 AtomicString mimeType() const; | 71 AtomicString mimeType() const; |
69 | 72 |
70 bool mimeTypeAllowedByNosniff() const; | 73 bool mimeTypeAllowedByNosniff() const; |
71 | 74 |
72 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { m_integrit
yMetadata = metadata; } | 75 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { m_integrit
yMetadata = metadata; } |
73 const IntegrityMetadataSet& integrityMetadata() const { return m_integrityMe
tadata; } | 76 const IntegrityMetadataSet& integrityMetadata() const { return m_integrityMe
tadata; } |
74 void setIntegrityAlreadyChecked(bool checked) { m_integrityChecked = checked
; } | 77 void setIntegrityAlreadyChecked(bool checked) { m_integrityChecked = checked
; } |
75 bool integrityAlreadyChecked() { return m_integrityChecked; } | 78 bool integrityAlreadyChecked() { return m_integrityChecked; } |
76 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const override; | 79 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const override; |
77 | 80 |
78 private: | 81 private: |
79 class ScriptResourceFactory : public ResourceFactory { | 82 class ScriptResourceFactory : public ResourceFactory { |
80 public: | 83 public: |
81 ScriptResourceFactory() | 84 ScriptResourceFactory() |
82 : ResourceFactory(Resource::Script) { } | 85 : ResourceFactory(Resource::Script) { } |
83 | 86 |
84 Resource* create(const ResourceRequest& request, const String& charset)
const override | 87 PassRefPtrWillBeRawPtr<Resource> create(const ResourceRequest& request,
const String& charset) const override |
85 { | 88 { |
86 return new ScriptResource(request, charset); | 89 return adoptRefWillBeNoop(new ScriptResource(request, charset)); |
87 } | 90 } |
88 }; | 91 }; |
89 | 92 |
| 93 ScriptResource(const ResourceRequest&, const String& charset); |
| 94 |
90 bool m_integrityChecked; | 95 bool m_integrityChecked; |
91 IntegrityMetadataSet m_integrityMetadata; | 96 IntegrityMetadataSet m_integrityMetadata; |
92 | 97 |
93 CompressibleString m_script; | 98 CompressibleString m_script; |
94 }; | 99 }; |
95 | 100 |
96 DEFINE_RESOURCE_TYPE_CASTS(Script); | 101 DEFINE_RESOURCE_TYPE_CASTS(Script); |
97 | 102 |
98 } // namespace blink | 103 } // namespace blink |
99 | 104 |
100 #endif | 105 #endif |
OLD | NEW |