OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LinkPreloadResourceClients_h | 5 #ifndef LinkPreloadResourceClients_h |
6 #define LinkPreloadResourceClients_h | 6 #define LinkPreloadResourceClients_h |
7 | 7 |
8 #include "core/fetch/CSSStyleSheetResource.h" | 8 #include "core/fetch/CSSStyleSheetResource.h" |
9 #include "core/fetch/FontResource.h" | 9 #include "core/fetch/FontResource.h" |
10 #include "core/fetch/ImageResource.h" | 10 #include "core/fetch/ImageResource.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 DEFINE_INLINE_VIRTUAL_TRACE() | 27 DEFINE_INLINE_VIRTUAL_TRACE() |
28 { | 28 { |
29 visitor->trace(m_loader); | 29 visitor->trace(m_loader); |
30 } | 30 } |
31 | 31 |
32 protected: | 32 protected: |
33 LinkPreloadResourceClient(LinkLoader* loader) | 33 LinkPreloadResourceClient(LinkLoader* loader) |
34 : m_loader(loader) | 34 : m_loader(loader) |
35 { | 35 { |
36 ASSERT(loader); | 36 DCHECK(loader); |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 Member<LinkLoader> m_loader; | 40 Member<LinkLoader> m_loader; |
41 }; | 41 }; |
42 | 42 |
43 class LinkPreloadScriptResourceClient: public LinkPreloadResourceClient, public
ResourceOwner<ScriptResource, ScriptResourceClient> { | 43 class LinkPreloadScriptResourceClient: public LinkPreloadResourceClient, public
ResourceOwner<ScriptResource, ScriptResourceClient> { |
44 USING_GARBAGE_COLLECTED_MIXIN(LinkPreloadScriptResourceClient); | 44 USING_GARBAGE_COLLECTED_MIXIN(LinkPreloadScriptResourceClient); |
45 public: | 45 public: |
46 static LinkPreloadScriptResourceClient* create(LinkLoader* loader, ScriptRes
ource* resource) | 46 static LinkPreloadScriptResourceClient* create(LinkLoader* loader, ScriptRes
ource* resource) |
47 { | 47 { |
48 return new LinkPreloadScriptResourceClient(loader, resource); | 48 return new LinkPreloadScriptResourceClient(loader, resource); |
49 } | 49 } |
50 | 50 |
51 virtual String debugName() const { return "LinkPreloadScript"; } | 51 virtual String debugName() const { return "LinkPreloadScript"; } |
52 virtual ~LinkPreloadScriptResourceClient() { } | 52 virtual ~LinkPreloadScriptResourceClient() { } |
53 | 53 |
54 void clear() override { clearResource(); } | 54 void clear() override { clearResource(); } |
55 | 55 |
56 void notifyFinished(Resource* resource) override | 56 void notifyFinished(Resource* resource) override |
57 { | 57 { |
58 ASSERT(this->resource() == resource); | 58 DCHECK_EQ(this->resource(), resource); |
59 triggerEvents(resource); | 59 triggerEvents(resource); |
60 } | 60 } |
61 | 61 |
62 DEFINE_INLINE_VIRTUAL_TRACE() | 62 DEFINE_INLINE_VIRTUAL_TRACE() |
63 { | 63 { |
64 LinkPreloadResourceClient::trace(visitor); | 64 LinkPreloadResourceClient::trace(visitor); |
65 ResourceOwner<ScriptResource, ScriptResourceClient>::trace(visitor); | 65 ResourceOwner<ScriptResource, ScriptResourceClient>::trace(visitor); |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
(...skipping 12 matching lines...) Expand all Loading... |
81 return new LinkPreloadStyleResourceClient(loader, resource); | 81 return new LinkPreloadStyleResourceClient(loader, resource); |
82 } | 82 } |
83 | 83 |
84 virtual String debugName() const { return "LinkPreloadStyle"; } | 84 virtual String debugName() const { return "LinkPreloadStyle"; } |
85 virtual ~LinkPreloadStyleResourceClient() { } | 85 virtual ~LinkPreloadStyleResourceClient() { } |
86 | 86 |
87 void clear() override { clearResource(); } | 87 void clear() override { clearResource(); } |
88 | 88 |
89 void setCSSStyleSheet(const String&, const KURL&, const String&, const CSSSt
yleSheetResource* resource) override | 89 void setCSSStyleSheet(const String&, const KURL&, const String&, const CSSSt
yleSheetResource* resource) override |
90 { | 90 { |
91 ASSERT(this->resource() == resource); | 91 DCHECK_EQ(this->resource(), resource); |
92 triggerEvents(static_cast<const Resource*>(resource)); | 92 triggerEvents(static_cast<const Resource*>(resource)); |
93 } | 93 } |
94 | 94 |
95 DEFINE_INLINE_VIRTUAL_TRACE() | 95 DEFINE_INLINE_VIRTUAL_TRACE() |
96 { | 96 { |
97 LinkPreloadResourceClient::trace(visitor); | 97 LinkPreloadResourceClient::trace(visitor); |
98 ResourceOwner<CSSStyleSheetResource, StyleSheetResourceClient>::trace(vi
sitor); | 98 ResourceOwner<CSSStyleSheetResource, StyleSheetResourceClient>::trace(vi
sitor); |
99 } | 99 } |
100 | 100 |
101 private: | 101 private: |
(...skipping 12 matching lines...) Expand all Loading... |
114 return new LinkPreloadImageResourceClient(loader, resource); | 114 return new LinkPreloadImageResourceClient(loader, resource); |
115 } | 115 } |
116 | 116 |
117 virtual String debugName() const { return "LinkPreloadImage"; } | 117 virtual String debugName() const { return "LinkPreloadImage"; } |
118 virtual ~LinkPreloadImageResourceClient() { } | 118 virtual ~LinkPreloadImageResourceClient() { } |
119 | 119 |
120 void clear() override { clearResource(); } | 120 void clear() override { clearResource(); } |
121 | 121 |
122 void notifyFinished(Resource* resource) override | 122 void notifyFinished(Resource* resource) override |
123 { | 123 { |
124 ASSERT(this->resource() == toImageResource(resource)); | 124 DCHECK_EQ(this->resource(), toImageResource(resource)); |
125 triggerEvents(resource); | 125 triggerEvents(resource); |
126 } | 126 } |
127 | 127 |
128 DEFINE_INLINE_VIRTUAL_TRACE() | 128 DEFINE_INLINE_VIRTUAL_TRACE() |
129 { | 129 { |
130 LinkPreloadResourceClient::trace(visitor); | 130 LinkPreloadResourceClient::trace(visitor); |
131 ResourceOwner<ImageResource>::trace(visitor); | 131 ResourceOwner<ImageResource>::trace(visitor); |
132 } | 132 } |
133 | 133 |
134 private: | 134 private: |
(...skipping 12 matching lines...) Expand all Loading... |
147 return new LinkPreloadFontResourceClient(loader, resource); | 147 return new LinkPreloadFontResourceClient(loader, resource); |
148 } | 148 } |
149 | 149 |
150 virtual String debugName() const { return "LinkPreloadFont"; } | 150 virtual String debugName() const { return "LinkPreloadFont"; } |
151 virtual ~LinkPreloadFontResourceClient() { } | 151 virtual ~LinkPreloadFontResourceClient() { } |
152 | 152 |
153 void clear() override { clearResource(); } | 153 void clear() override { clearResource(); } |
154 | 154 |
155 void notifyFinished(Resource* resource) override | 155 void notifyFinished(Resource* resource) override |
156 { | 156 { |
157 ASSERT(this->resource() == toFontResource(resource)); | 157 DCHECK_EQ(this->resource(), toFontResource(resource)); |
158 triggerEvents(resource); | 158 triggerEvents(resource); |
159 } | 159 } |
160 | 160 |
161 DEFINE_INLINE_VIRTUAL_TRACE() | 161 DEFINE_INLINE_VIRTUAL_TRACE() |
162 { | 162 { |
163 LinkPreloadResourceClient::trace(visitor); | 163 LinkPreloadResourceClient::trace(visitor); |
164 ResourceOwner<FontResource, FontResourceClient>::trace(visitor); | 164 ResourceOwner<FontResource, FontResourceClient>::trace(visitor); |
165 } | 165 } |
166 | 166 |
167 private: | 167 private: |
(...skipping 12 matching lines...) Expand all Loading... |
180 return new LinkPreloadRawResourceClient(loader, resource); | 180 return new LinkPreloadRawResourceClient(loader, resource); |
181 } | 181 } |
182 | 182 |
183 virtual String debugName() const { return "LinkPreloadRaw"; } | 183 virtual String debugName() const { return "LinkPreloadRaw"; } |
184 virtual ~LinkPreloadRawResourceClient() { } | 184 virtual ~LinkPreloadRawResourceClient() { } |
185 | 185 |
186 void clear() override { clearResource(); } | 186 void clear() override { clearResource(); } |
187 | 187 |
188 void notifyFinished(Resource* resource) override | 188 void notifyFinished(Resource* resource) override |
189 { | 189 { |
190 ASSERT(this->resource() == toRawResource(resource)); | 190 DCHECK_EQ(this->resource(), toRawResource(resource)); |
191 triggerEvents(resource); | 191 triggerEvents(resource); |
192 } | 192 } |
193 | 193 |
194 DEFINE_INLINE_VIRTUAL_TRACE() | 194 DEFINE_INLINE_VIRTUAL_TRACE() |
195 { | 195 { |
196 LinkPreloadResourceClient::trace(visitor); | 196 LinkPreloadResourceClient::trace(visitor); |
197 ResourceOwner<RawResource, RawResourceClient>::trace(visitor); | 197 ResourceOwner<RawResource, RawResourceClient>::trace(visitor); |
198 } | 198 } |
199 | 199 |
200 private: | 200 private: |
201 LinkPreloadRawResourceClient(LinkLoader* loader, RawResource* resource) | 201 LinkPreloadRawResourceClient(LinkLoader* loader, RawResource* resource) |
202 : LinkPreloadResourceClient(loader) | 202 : LinkPreloadResourceClient(loader) |
203 { | 203 { |
204 setResource(resource); | 204 setResource(resource); |
205 } | 205 } |
206 }; | 206 }; |
207 | 207 |
208 } // namespace blink | 208 } // namespace blink |
209 | 209 |
210 #endif // LinkPreloadResourceClients_h | 210 #endif // LinkPreloadResourceClients_h |
OLD | NEW |