OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2009 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool HadError() const { return !failed_load_url_.IsEmpty(); } | 119 bool HadError() const { return !failed_load_url_.IsEmpty(); } |
120 | 120 |
121 void DispatchPendingEvent(ImageEventSender*); | 121 void DispatchPendingEvent(ImageEventSender*); |
122 | 122 |
123 static void DispatchPendingLoadEvents(); | 123 static void DispatchPendingLoadEvents(); |
124 static void DispatchPendingErrorEvents(); | 124 static void DispatchPendingErrorEvents(); |
125 | 125 |
126 bool GetImageAnimationPolicy(ImageAnimationPolicy&) final; | 126 bool GetImageAnimationPolicy(ImageAnimationPolicy&) final; |
127 | 127 |
128 protected: | 128 protected: |
| 129 void ImageChanged(ImageResourceContent*, const IntRect*) override; |
129 void ImageNotifyFinished(ImageResourceContent*) override; | 130 void ImageNotifyFinished(ImageResourceContent*) override; |
130 | 131 |
131 private: | 132 private: |
132 class Task; | 133 class Task; |
133 | 134 |
134 // Called from the task or from updateFromElement to initiate the load. | 135 // Called from the task or from updateFromElement to initiate the load. |
135 void DoUpdateFromElement(BypassMainWorldBehavior, | 136 void DoUpdateFromElement(BypassMainWorldBehavior, |
136 UpdateFromElementBehavior, | 137 UpdateFromElementBehavior, |
137 const KURL&, | 138 const KURL&, |
138 ReferrerPolicy = kReferrerPolicyDefault); | 139 ReferrerPolicy = kReferrerPolicyDefault); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 Member<ImageResourceContent> image_; | 180 Member<ImageResourceContent> image_; |
180 Member<ImageResource> image_resource_for_image_document_; | 181 Member<ImageResource> image_resource_for_image_document_; |
181 // FIXME: Oilpan: We might be able to remove this Persistent hack when | 182 // FIXME: Oilpan: We might be able to remove this Persistent hack when |
182 // ImageResourceClient is traceable. | 183 // ImageResourceClient is traceable. |
183 GC_PLUGIN_IGNORE("http://crbug.com/383741") | 184 GC_PLUGIN_IGNORE("http://crbug.com/383741") |
184 Persistent<Element> keep_alive_; | 185 Persistent<Element> keep_alive_; |
185 | 186 |
186 Timer<ImageLoader> deref_element_timer_; | 187 Timer<ImageLoader> deref_element_timer_; |
187 AtomicString failed_load_url_; | 188 AtomicString failed_load_url_; |
188 WeakPtr<Task> pending_task_; // owned by Microtask | 189 WeakPtr<Task> pending_task_; // owned by Microtask |
189 std::unique_ptr<IncrementLoadEventDelayCount> load_delay_counter_; | 190 std::unique_ptr<IncrementLoadEventDelayCount> |
| 191 delay_until_do_update_from_element_; |
| 192 |
| 193 // Delaying load event: the timeline should be: |
| 194 // (0) ImageResource::Fetch() is called. |
| 195 // (1) ResourceFetcher::StartLoad(): Resource loading is actually started. |
| 196 // (2) ResourceLoader::DidFinishLoading() etc: |
| 197 // Resource loading is finished, but SVG document load might be |
| 198 // incomplete because of asynchronously loaded subresources. |
| 199 // (3) ImageNotifyFinished(): Image is completely loaded. |
| 200 // and we delay Document load event from (1) to (3): |
| 201 // - |ResourceFetcher::loaders_| delays Document load event from (1) to (2). |
| 202 // - |delay_until_image_notify_finished_| delays Document load event from |
| 203 // the first ImageChanged() (at some time between (1) and (2)) until (3). |
| 204 // Ideally, we might want to delay Document load event from (1) to (3), |
| 205 // but currently we piggyback on ImageChanged() because adding a callback |
| 206 // hook at (1) might complicate the code. |
| 207 std::unique_ptr<IncrementLoadEventDelayCount> |
| 208 delay_until_image_notify_finished_; |
| 209 |
190 bool has_pending_load_event_ : 1; | 210 bool has_pending_load_event_ : 1; |
191 bool has_pending_error_event_ : 1; | 211 bool has_pending_error_event_ : 1; |
192 bool image_complete_ : 1; | 212 bool image_complete_ : 1; |
193 bool loading_image_document_ : 1; | 213 bool loading_image_document_ : 1; |
194 bool element_is_protected_ : 1; | 214 bool element_is_protected_ : 1; |
195 bool suppress_error_events_ : 1; | 215 bool suppress_error_events_ : 1; |
196 }; | 216 }; |
197 | 217 |
198 } // namespace blink | 218 } // namespace blink |
199 | 219 |
200 #endif | 220 #endif |
OLD | NEW |