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 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 DEFINE_INLINE_VIRTUAL_TRACE() | 28 DEFINE_INLINE_VIRTUAL_TRACE() |
29 { | 29 { |
30 visitor->trace(m_loader); | 30 visitor->trace(m_loader); |
31 } | 31 } |
32 | 32 |
33 protected: | 33 protected: |
34 LinkPreloadResourceClient(LinkLoader* loader) | 34 LinkPreloadResourceClient(LinkLoader* loader) |
35 : m_loader(loader) | 35 : m_loader(loader) |
36 { | 36 { |
37 ASSERT(loader); | 37 DCHECK(loader); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 Member<LinkLoader> m_loader; | 41 Member<LinkLoader> m_loader; |
42 }; | 42 }; |
43 | 43 |
44 class LinkPreloadScriptResourceClient: public LinkPreloadResourceClient, public ResourceOwner<ScriptResource, ScriptResourceClient> { | 44 class LinkPreloadScriptResourceClient: public LinkPreloadResourceClient, public ResourceOwner<ScriptResource, ScriptResourceClient> { |
45 USING_GARBAGE_COLLECTED_MIXIN(LinkPreloadScriptResourceClient); | 45 USING_GARBAGE_COLLECTED_MIXIN(LinkPreloadScriptResourceClient); |
46 public: | 46 public: |
47 static LinkPreloadScriptResourceClient* create(LinkLoader* loader, ScriptRes ource* resource) | 47 static LinkPreloadScriptResourceClient* create(LinkLoader* loader, ScriptRes ource* resource) |
48 { | 48 { |
49 return new LinkPreloadScriptResourceClient(loader, resource); | 49 return new LinkPreloadScriptResourceClient(loader, resource); |
50 } | 50 } |
51 | 51 |
52 virtual String debugName() const { return "LinkPreloadScript"; } | 52 virtual String debugName() const { return "LinkPreloadScript"; } |
53 virtual ~LinkPreloadScriptResourceClient() { } | 53 virtual ~LinkPreloadScriptResourceClient() { } |
54 | 54 |
55 void clear() override { clearResource(); } | 55 void clear() override { clearResource(); } |
56 | 56 |
57 void notifyFinished(Resource* resource) override | 57 void notifyFinished(Resource* resource) override |
58 { | 58 { |
59 ASSERT(this->resource() == resource); | 59 DCHECK(this->resource() == resource); |
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
60 triggerEvents(resource); | 60 triggerEvents(resource); |
61 } | 61 } |
62 | 62 |
63 DEFINE_INLINE_VIRTUAL_TRACE() | 63 DEFINE_INLINE_VIRTUAL_TRACE() |
64 { | 64 { |
65 LinkPreloadResourceClient::trace(visitor); | 65 LinkPreloadResourceClient::trace(visitor); |
66 ResourceOwner<ScriptResource, ScriptResourceClient>::trace(visitor); | 66 ResourceOwner<ScriptResource, ScriptResourceClient>::trace(visitor); |
67 } | 67 } |
68 | 68 |
69 private: | 69 private: |
(...skipping 12 matching lines...) Expand all Loading... | |
82 return new LinkPreloadStyleResourceClient(loader, resource); | 82 return new LinkPreloadStyleResourceClient(loader, resource); |
83 } | 83 } |
84 | 84 |
85 virtual String debugName() const { return "LinkPreloadStyle"; } | 85 virtual String debugName() const { return "LinkPreloadStyle"; } |
86 virtual ~LinkPreloadStyleResourceClient() { } | 86 virtual ~LinkPreloadStyleResourceClient() { } |
87 | 87 |
88 void clear() override { clearResource(); } | 88 void clear() override { clearResource(); } |
89 | 89 |
90 void setCSSStyleSheet(const String&, const KURL&, const String&, const CSSSt yleSheetResource* resource) override | 90 void setCSSStyleSheet(const String&, const KURL&, const String&, const CSSSt yleSheetResource* resource) override |
91 { | 91 { |
92 ASSERT(this->resource() == resource); | 92 DCHECK(this->resource() == resource); |
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
93 triggerEvents(static_cast<const Resource*>(resource)); | 93 triggerEvents(static_cast<const Resource*>(resource)); |
94 } | 94 } |
95 | 95 |
96 DEFINE_INLINE_VIRTUAL_TRACE() | 96 DEFINE_INLINE_VIRTUAL_TRACE() |
97 { | 97 { |
98 LinkPreloadResourceClient::trace(visitor); | 98 LinkPreloadResourceClient::trace(visitor); |
99 ResourceOwner<CSSStyleSheetResource, StyleSheetResourceClient>::trace(vi sitor); | 99 ResourceOwner<CSSStyleSheetResource, StyleSheetResourceClient>::trace(vi sitor); |
100 } | 100 } |
101 | 101 |
102 private: | 102 private: |
(...skipping 12 matching lines...) Expand all Loading... | |
115 return new LinkPreloadImageResourceClient(loader, resource); | 115 return new LinkPreloadImageResourceClient(loader, resource); |
116 } | 116 } |
117 | 117 |
118 virtual String debugName() const { return "LinkPreloadImage"; } | 118 virtual String debugName() const { return "LinkPreloadImage"; } |
119 virtual ~LinkPreloadImageResourceClient() { } | 119 virtual ~LinkPreloadImageResourceClient() { } |
120 | 120 |
121 void clear() override { clearResource(); } | 121 void clear() override { clearResource(); } |
122 | 122 |
123 void notifyFinished(Resource* resource) override | 123 void notifyFinished(Resource* resource) override |
124 { | 124 { |
125 ASSERT(this->resource() == toImageResource(resource)); | 125 DCHECK(this->resource() == toImageResource(resource)); |
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
126 triggerEvents(resource); | 126 triggerEvents(resource); |
127 } | 127 } |
128 | 128 |
129 DEFINE_INLINE_VIRTUAL_TRACE() | 129 DEFINE_INLINE_VIRTUAL_TRACE() |
130 { | 130 { |
131 LinkPreloadResourceClient::trace(visitor); | 131 LinkPreloadResourceClient::trace(visitor); |
132 ResourceOwner<ImageResource>::trace(visitor); | 132 ResourceOwner<ImageResource>::trace(visitor); |
133 } | 133 } |
134 | 134 |
135 private: | 135 private: |
(...skipping 12 matching lines...) Expand all Loading... | |
148 return new LinkPreloadFontResourceClient(loader, resource); | 148 return new LinkPreloadFontResourceClient(loader, resource); |
149 } | 149 } |
150 | 150 |
151 virtual String debugName() const { return "LinkPreloadFont"; } | 151 virtual String debugName() const { return "LinkPreloadFont"; } |
152 virtual ~LinkPreloadFontResourceClient() { } | 152 virtual ~LinkPreloadFontResourceClient() { } |
153 | 153 |
154 void clear() override { clearResource(); } | 154 void clear() override { clearResource(); } |
155 | 155 |
156 void notifyFinished(Resource* resource) override | 156 void notifyFinished(Resource* resource) override |
157 { | 157 { |
158 ASSERT(this->resource() == toFontResource(resource)); | 158 DCHECK(this->resource() == toFontResource(resource)); |
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
159 triggerEvents(resource); | 159 triggerEvents(resource); |
160 } | 160 } |
161 | 161 |
162 DEFINE_INLINE_VIRTUAL_TRACE() | 162 DEFINE_INLINE_VIRTUAL_TRACE() |
163 { | 163 { |
164 LinkPreloadResourceClient::trace(visitor); | 164 LinkPreloadResourceClient::trace(visitor); |
165 ResourceOwner<FontResource, FontResourceClient>::trace(visitor); | 165 ResourceOwner<FontResource, FontResourceClient>::trace(visitor); |
166 } | 166 } |
167 | 167 |
168 private: | 168 private: |
(...skipping 12 matching lines...) Expand all Loading... | |
181 return new LinkPreloadRawResourceClient(loader, resource); | 181 return new LinkPreloadRawResourceClient(loader, resource); |
182 } | 182 } |
183 | 183 |
184 virtual String debugName() const { return "LinkPreloadRaw"; } | 184 virtual String debugName() const { return "LinkPreloadRaw"; } |
185 virtual ~LinkPreloadRawResourceClient() { } | 185 virtual ~LinkPreloadRawResourceClient() { } |
186 | 186 |
187 void clear() override { clearResource(); } | 187 void clear() override { clearResource(); } |
188 | 188 |
189 void notifyFinished(Resource* resource) override | 189 void notifyFinished(Resource* resource) override |
190 { | 190 { |
191 ASSERT(this->resource() == toRawResource(resource)); | 191 DCHECK(this->resource() == toRawResource(resource)); |
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
192 triggerEvents(resource); | 192 triggerEvents(resource); |
193 } | 193 } |
194 | 194 |
195 DEFINE_INLINE_VIRTUAL_TRACE() | 195 DEFINE_INLINE_VIRTUAL_TRACE() |
196 { | 196 { |
197 LinkPreloadResourceClient::trace(visitor); | 197 LinkPreloadResourceClient::trace(visitor); |
198 ResourceOwner<RawResource, RawResourceClient>::trace(visitor); | 198 ResourceOwner<RawResource, RawResourceClient>::trace(visitor); |
199 } | 199 } |
200 | 200 |
201 private: | 201 private: |
202 LinkPreloadRawResourceClient(LinkLoader* loader, RawResource* resource) | 202 LinkPreloadRawResourceClient(LinkLoader* loader, RawResource* resource) |
203 : LinkPreloadResourceClient(loader) | 203 : LinkPreloadResourceClient(loader) |
204 { | 204 { |
205 setResource(resource); | 205 setResource(resource); |
206 } | 206 } |
207 }; | 207 }; |
208 | 208 |
209 } // namespace blink | 209 } // namespace blink |
210 | 210 |
211 #endif // LinkPreloadResourceClients_h | 211 #endif // LinkPreloadResourceClients_h |
OLD | NEW |