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

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

Issue 2864253003: Split ImageLoader::SetImage() and set flags consistently in tests (Closed)
Patch Set: Update comment 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 void ElementDidMoveToNewDocument(); 83 void ElementDidMoveToNewDocument();
84 84
85 Element* GetElement() const { return element_; } 85 Element* GetElement() const { return element_; }
86 bool ImageComplete() const { return image_complete_ && !pending_task_; } 86 bool ImageComplete() const { return image_complete_ && !pending_task_; }
87 87
88 ImageResourceContent* GetImage() const { return image_.Get(); } 88 ImageResourceContent* GetImage() const { return image_.Get(); }
89 ImageResource* ImageResourceForImageDocument() const { 89 ImageResource* ImageResourceForImageDocument() const {
90 return image_resource_for_image_document_; 90 return image_resource_for_image_document_;
91 } 91 }
92
92 // Cancels pending load events, and doesn't dispatch new ones. 93 // Cancels pending load events, and doesn't dispatch new ones.
93 void SetImage(ImageResourceContent*); 94 // Note: ClearImage/SetImage.*() are not a simple setter.
95 // Check the implementation to see what they do.
96 // TODO(hiroshige): Cleanup these methods.
97 void ClearImage();
98 void SetImageForTest(ImageResourceContent*);
94 99
95 bool IsLoadingImageDocument() { return loading_image_document_; } 100 bool IsLoadingImageDocument() { return loading_image_document_; }
96 void SetLoadingImageDocument() { loading_image_document_ = true; } 101 void SetLoadingImageDocument() { loading_image_document_ = true; }
97 102
98 bool HasPendingActivity() const { 103 bool HasPendingActivity() const {
99 return has_pending_load_event_ || has_pending_error_event_ || pending_task_; 104 return has_pending_load_event_ || has_pending_error_event_ || pending_task_;
100 } 105 }
101 106
102 bool HasPendingError() const { return has_pending_error_event_; } 107 bool HasPendingError() const { return has_pending_error_event_; }
103 108
(...skipping 22 matching lines...) Expand all
126 virtual void NoImageResourceToLoad() {} 131 virtual void NoImageResourceToLoad() {}
127 132
128 void UpdatedHasPendingEvent(); 133 void UpdatedHasPendingEvent();
129 134
130 void DispatchPendingLoadEvent(); 135 void DispatchPendingLoadEvent();
131 void DispatchPendingErrorEvent(); 136 void DispatchPendingErrorEvent();
132 137
133 LayoutImageResource* GetLayoutImageResource(); 138 LayoutImageResource* GetLayoutImageResource();
134 void UpdateLayoutObject(); 139 void UpdateLayoutObject();
135 140
141 // Note: SetImage.*() are not a simple setter.
142 // Check the implementation to see what they do.
143 // TODO(hiroshige): Cleanup these methods.
144 void SetImageForImageDocument(ImageResource*);
136 void SetImageWithoutConsideringPendingLoadEvent(ImageResourceContent*); 145 void SetImageWithoutConsideringPendingLoadEvent(ImageResourceContent*);
146 void UpdateImageState(ImageResourceContent*);
147
137 void ClearFailedLoadURL(); 148 void ClearFailedLoadURL();
138 void DispatchErrorEvent(); 149 void DispatchErrorEvent();
139 void CrossSiteOrCSPViolationOccurred(AtomicString); 150 void CrossSiteOrCSPViolationOccurred(AtomicString);
140 void EnqueueImageLoadingMicroTask(UpdateFromElementBehavior, ReferrerPolicy); 151 void EnqueueImageLoadingMicroTask(UpdateFromElementBehavior, ReferrerPolicy);
141 152
142 void TimerFired(TimerBase*); 153 void TimerFired(TimerBase*);
143 154
144 KURL ImageSourceToKURL(AtomicString) const; 155 KURL ImageSourceToKURL(AtomicString) const;
145 156
146 // Used to determine whether to immediately initiate the load or to schedule a 157 // Used to determine whether to immediately initiate the load or to schedule a
(...skipping 23 matching lines...) Expand all
170 bool has_pending_error_event_ : 1; 181 bool has_pending_error_event_ : 1;
171 bool image_complete_ : 1; 182 bool image_complete_ : 1;
172 bool loading_image_document_ : 1; 183 bool loading_image_document_ : 1;
173 bool element_is_protected_ : 1; 184 bool element_is_protected_ : 1;
174 bool suppress_error_events_ : 1; 185 bool suppress_error_events_ : 1;
175 }; 186 };
176 187
177 } // namespace blink 188 } // namespace blink
178 189
179 #endif 190 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLObjectElement.cpp ('k') | third_party/WebKit/Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698