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

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: nit 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Cancels pending load events, and doesn't dispatch new ones. 92 // Cancels pending load events, and doesn't dispatch new ones.
93 void SetImage(ImageResourceContent*); 93 void SetImage(ImageResourceContent*);
94 94
95 bool IsLoadingImageDocument() { return loading_image_document_; } 95 bool IsLoadingImageDocument() { return loading_image_document_; }
96 void SetLoadingImageDocument() { loading_image_document_ = true; } 96 void SetLoadingImageDocument() { loading_image_document_ = true; }
97 97
98 bool HasPendingActivity() const { 98 bool HasPendingActivity() const {
99 return has_pending_load_event_ || has_pending_error_event_ || pending_task_; 99 return (image_ && !image_complete_) || has_pending_load_event_ ||
kouhei (in TOK) 2017/05/08 13:18:40 :) This totally makes sense!
100 has_pending_error_event_ || pending_task_;
100 } 101 }
101 102
102 bool HasPendingError() const { return has_pending_error_event_; } 103 bool HasPendingError() const { return has_pending_error_event_; }
103 104
104 bool HadError() const { return !failed_load_url_.IsEmpty(); } 105 bool HadError() const { return !failed_load_url_.IsEmpty(); }
105 106
106 void DispatchPendingEvent(ImageEventSender*); 107 void DispatchPendingEvent(ImageEventSender*);
107 108
108 static void DispatchPendingLoadEvents(); 109 static void DispatchPendingLoadEvents();
109 static void DispatchPendingErrorEvents(); 110 static void DispatchPendingErrorEvents();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // and we delay Document load event from (1) to (3): 180 // and we delay Document load event from (1) to (3):
180 // - |ResourceFetcher::loaders_| delays Document load event from (1) to (2). 181 // - |ResourceFetcher::loaders_| delays Document load event from (1) to (2).
181 // - |delay_until_image_notify_finished_| delays Document load event from 182 // - |delay_until_image_notify_finished_| delays Document load event from
182 // the first ImageChanged() (at some time between (1) and (2)) until (3). 183 // 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 // 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 // but currently we piggyback on ImageChanged() because adding a callback
185 // hook at (1) might complicate the code. 186 // hook at (1) might complicate the code.
186 std::unique_ptr<IncrementLoadEventDelayCount> 187 std::unique_ptr<IncrementLoadEventDelayCount>
187 delay_until_image_notify_finished_; 188 delay_until_image_notify_finished_;
188 189
189 bool has_pending_load_event_ : 1; 190 bool has_pending_load_event_ : 1;
kinuko 2017/05/08 05:36:46 Could we have a short comment for this field here
kouhei (in TOK) 2017/05/08 13:18:40 +1 I think you basically need to say that we are s
hiroshige 2017/05/08 19:05:26 Done.
190 bool has_pending_error_event_ : 1; 191 bool has_pending_error_event_ : 1;
191 bool image_complete_ : 1; 192 bool image_complete_ : 1;
192 bool loading_image_document_ : 1; 193 bool loading_image_document_ : 1;
193 bool element_is_protected_ : 1; 194 bool element_is_protected_ : 1;
194 bool suppress_error_events_ : 1; 195 bool suppress_error_events_ : 1;
195 }; 196 };
196 197
197 } // namespace blink 198 } // namespace blink
198 199
199 #endif 200 #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