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

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

Issue 2859093003: Change the semantics of ImageLoader::has_pending_load_event_ (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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // and data to |image_resource_for_image_document_| and thus |image_|. 103 // and data to |image_resource_for_image_document_| and thus |image_|.
104 // Otherwise: 104 // Otherwise:
105 // Normal loading via ResourceFetcher/ResourceLoader. 105 // Normal loading via ResourceFetcher/ResourceLoader.
106 // |image_resource_for_image_document_| is null. 106 // |image_resource_for_image_document_| is null.
107 bool IsLoadingImageDocument() { return loading_image_document_; } 107 bool IsLoadingImageDocument() { return loading_image_document_; }
108 void SetLoadingImageDocument() { loading_image_document_ = true; } 108 void SetLoadingImageDocument() { loading_image_document_ = true; }
109 ImageResource* ImageResourceForImageDocument() const { 109 ImageResource* ImageResourceForImageDocument() const {
110 return image_resource_for_image_document_; 110 return image_resource_for_image_document_;
111 } 111 }
112 112
113 bool HasPendingActivity() const { 113 bool HasPendingActivity() const { return HasPendingEvent() || pending_task_; }
114 return has_pending_load_event_ || has_pending_error_event_ || pending_task_;
115 }
116 114
117 bool HasPendingError() const { return has_pending_error_event_; } 115 bool HasPendingError() const { return has_pending_error_event_; }
118 116
119 bool HadError() const { return !failed_load_url_.IsEmpty(); } 117 bool HadError() const { return !failed_load_url_.IsEmpty(); }
120 118
121 void DispatchPendingEvent(ImageEventSender*); 119 void DispatchPendingEvent(ImageEventSender*);
122 120
123 static void DispatchPendingLoadEvents(); 121 static void DispatchPendingLoadEvents();
124 static void DispatchPendingErrorEvents(); 122 static void DispatchPendingErrorEvents();
125 123
126 bool GetImageAnimationPolicy(ImageAnimationPolicy&) final; 124 bool GetImageAnimationPolicy(ImageAnimationPolicy&) final;
127 125
128 protected: 126 protected:
129 void ImageChanged(ImageResourceContent*, const IntRect*) override; 127 void ImageChanged(ImageResourceContent*, const IntRect*) override;
130 void ImageNotifyFinished(ImageResourceContent*) override; 128 void ImageNotifyFinished(ImageResourceContent*) override;
131 129
132 private: 130 private:
133 class Task; 131 class Task;
134 132
135 // Called from the task or from updateFromElement to initiate the load. 133 // Called from the task or from updateFromElement to initiate the load.
136 void DoUpdateFromElement(BypassMainWorldBehavior, 134 void DoUpdateFromElement(BypassMainWorldBehavior,
137 UpdateFromElementBehavior, 135 UpdateFromElementBehavior,
138 const KURL&, 136 const KURL&,
139 ReferrerPolicy = kReferrerPolicyDefault); 137 ReferrerPolicy = kReferrerPolicyDefault);
140 138
141 virtual void DispatchLoadEvent() = 0; 139 virtual void DispatchLoadEvent() = 0;
142 virtual void NoImageResourceToLoad() {} 140 virtual void NoImageResourceToLoad() {}
143 141
142 bool HasPendingEvent() const;
144 void UpdatedHasPendingEvent(); 143 void UpdatedHasPendingEvent();
145 144
146 void DispatchPendingLoadEvent(); 145 void DispatchPendingLoadEvent();
147 void DispatchPendingErrorEvent(); 146 void DispatchPendingErrorEvent();
148 147
149 LayoutImageResource* GetLayoutImageResource(); 148 LayoutImageResource* GetLayoutImageResource();
150 void UpdateLayoutObject(); 149 void UpdateLayoutObject();
151 150
152 // Note: SetImage.*() are not a simple setter. 151 // Note: SetImage.*() are not a simple setter.
153 // Check the implementation to see what they do. 152 // Check the implementation to see what they do.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // and we delay Document load event from (1) to (3): 199 // and we delay Document load event from (1) to (3):
201 // - |ResourceFetcher::loaders_| delays Document load event from (1) to (2). 200 // - |ResourceFetcher::loaders_| delays Document load event from (1) to (2).
202 // - |delay_until_image_notify_finished_| delays Document load event from 201 // - |delay_until_image_notify_finished_| delays Document load event from
203 // the first ImageChanged() (at some time between (1) and (2)) until (3). 202 // 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), 203 // Ideally, we might want to delay Document load event from (1) to (3),
205 // but currently we piggyback on ImageChanged() because adding a callback 204 // but currently we piggyback on ImageChanged() because adding a callback
206 // hook at (1) might complicate the code. 205 // hook at (1) might complicate the code.
207 std::unique_ptr<IncrementLoadEventDelayCount> 206 std::unique_ptr<IncrementLoadEventDelayCount>
208 delay_until_image_notify_finished_; 207 delay_until_image_notify_finished_;
209 208
209 // Indicates whether there is a pending task for the load/error event on
210 // EventSender. Will be replaced when EventSender is removed crbug/624697.
210 bool has_pending_load_event_ : 1; 211 bool has_pending_load_event_ : 1;
211 bool has_pending_error_event_ : 1; 212 bool has_pending_error_event_ : 1;
213
212 bool image_complete_ : 1; 214 bool image_complete_ : 1;
213 bool loading_image_document_ : 1; 215 bool loading_image_document_ : 1;
214 bool element_is_protected_ : 1; 216 bool element_is_protected_ : 1;
215 bool suppress_error_events_ : 1; 217 bool suppress_error_events_ : 1;
216 }; 218 };
217 219
218 } // namespace blink 220 } // namespace blink
219 221
220 #endif 222 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698