Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: third_party/WebKit/Source/core/loader/ImageLoader.h

Issue 2613853002: Phase III Step 2: Call imageNotifyFinished() and image load event after SVG loading completes (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 bool HadError() const { return !failed_load_url_.IsEmpty(); } 104 bool HadError() const { return !failed_load_url_.IsEmpty(); }
105 105
106 void DispatchPendingEvent(ImageEventSender*); 106 void DispatchPendingEvent(ImageEventSender*);
107 107
108 static void DispatchPendingLoadEvents(); 108 static void DispatchPendingLoadEvents();
109 static void DispatchPendingErrorEvents(); 109 static void DispatchPendingErrorEvents();
110 110
111 bool GetImageAnimationPolicy(ImageAnimationPolicy&) final; 111 bool GetImageAnimationPolicy(ImageAnimationPolicy&) final;
112 112
113 protected: 113 protected:
114 void ImageChanged(ImageResourceContent*, const IntRect*) override;
114 void ImageNotifyFinished(ImageResourceContent*) override; 115 void ImageNotifyFinished(ImageResourceContent*) override;
115 116
116 private: 117 private:
117 class Task; 118 class Task;
118 119
119 // Called from the task or from updateFromElement to initiate the load. 120 // Called from the task or from updateFromElement to initiate the load.
120 void DoUpdateFromElement(BypassMainWorldBehavior, 121 void DoUpdateFromElement(BypassMainWorldBehavior,
121 UpdateFromElementBehavior, 122 UpdateFromElementBehavior,
122 const KURL&, 123 const KURL&,
123 ReferrerPolicy = kReferrerPolicyDefault); 124 ReferrerPolicy = kReferrerPolicyDefault);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 Member<ImageResourceContent> image_; 159 Member<ImageResourceContent> image_;
159 Member<ImageResource> image_resource_for_image_document_; 160 Member<ImageResource> image_resource_for_image_document_;
160 // FIXME: Oilpan: We might be able to remove this Persistent hack when 161 // FIXME: Oilpan: We might be able to remove this Persistent hack when
161 // ImageResourceClient is traceable. 162 // ImageResourceClient is traceable.
162 GC_PLUGIN_IGNORE("http://crbug.com/383741") 163 GC_PLUGIN_IGNORE("http://crbug.com/383741")
163 Persistent<Element> keep_alive_; 164 Persistent<Element> keep_alive_;
164 165
165 Timer<ImageLoader> deref_element_timer_; 166 Timer<ImageLoader> deref_element_timer_;
166 AtomicString failed_load_url_; 167 AtomicString failed_load_url_;
167 WeakPtr<Task> pending_task_; // owned by Microtask 168 WeakPtr<Task> pending_task_; // owned by Microtask
168 std::unique_ptr<IncrementLoadEventDelayCount> load_delay_counter_; 169 std::unique_ptr<IncrementLoadEventDelayCount>
170 delay_until_do_update_from_element_;
171
172 // Delaying load event: the timeline should be:
173 // (0) ImageResource::Fetch() is called.
174 // (1) ResourceFetcher::StartLoad(): Resource loading is actually started.
175 // (2) ResourceLoader::DidFinishLoading() etc:
176 // Resource loading is finished, but SVG document load might be
177 // incomplete because of asynchronously loaded subresources.
178 // (3) ImageNotifyFinished(): Image is completely loaded.
179 // and we delay Document load event from (1) to (3):
180 // - |ResourceFetcher::loaders_| delays Document load event from (1) to (2).
181 // - |delay_until_image_notify_finished_| delays Document load event from
182 // the first ImageChanged() (at some time between (1) and (2)) until (3).
183 // Ideally, we might want to delay Document load event from (1) to (3),
184 // but currently we piggyback on ImageChanged() because adding a callback
185 // hook at (1) might complicate the code.
186 std::unique_ptr<IncrementLoadEventDelayCount>
187 delay_until_image_notify_finished_;
188
169 bool has_pending_load_event_ : 1; 189 bool has_pending_load_event_ : 1;
170 bool has_pending_error_event_ : 1; 190 bool has_pending_error_event_ : 1;
171 bool image_complete_ : 1; 191 bool image_complete_ : 1;
172 bool loading_image_document_ : 1; 192 bool loading_image_document_ : 1;
173 bool element_is_protected_ : 1; 193 bool element_is_protected_ : 1;
174 bool suppress_error_events_ : 1; 194 bool suppress_error_events_ : 1;
175 }; 195 };
176 196
177 } // namespace blink 197 } // namespace blink
178 198
179 #endif 199 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698