Chromium Code Reviews| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 bool hadError() const { return !m_failedLoadURL.isEmpty(); } | 101 bool hadError() const { return !m_failedLoadURL.isEmpty(); } |
| 102 | 102 |
| 103 void dispatchPendingEvent(ImageEventSender*); | 103 void dispatchPendingEvent(ImageEventSender*); |
| 104 | 104 |
| 105 static void dispatchPendingLoadEvents(); | 105 static void dispatchPendingLoadEvents(); |
| 106 static void dispatchPendingErrorEvents(); | 106 static void dispatchPendingErrorEvents(); |
| 107 | 107 |
| 108 bool getImageAnimationPolicy(ImageAnimationPolicy&) final; | 108 bool getImageAnimationPolicy(ImageAnimationPolicy&) final; |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 void imageChanged(ImageResourceContent*, const IntRect*) override; | |
| 111 void imageNotifyFinished(ImageResourceContent*) override; | 112 void imageNotifyFinished(ImageResourceContent*) override; |
| 112 | 113 |
| 113 private: | 114 private: |
| 114 class Task; | 115 class Task; |
| 115 | 116 |
| 116 // Called from the task or from updateFromElement to initiate the load. | 117 // Called from the task or from updateFromElement to initiate the load. |
| 117 void doUpdateFromElement(BypassMainWorldBehavior, | 118 void doUpdateFromElement(BypassMainWorldBehavior, |
| 118 UpdateFromElementBehavior, | 119 UpdateFromElementBehavior, |
| 119 const KURL&, | 120 const KURL&, |
| 120 ReferrerPolicy = ReferrerPolicyDefault); | 121 ReferrerPolicy = ReferrerPolicyDefault); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 Member<ImageResourceContent> m_image; | 156 Member<ImageResourceContent> m_image; |
| 156 Member<ImageResource> m_imageResourceForImageDocument; | 157 Member<ImageResource> m_imageResourceForImageDocument; |
| 157 // FIXME: Oilpan: We might be able to remove this Persistent hack when | 158 // FIXME: Oilpan: We might be able to remove this Persistent hack when |
| 158 // ImageResourceClient is traceable. | 159 // ImageResourceClient is traceable. |
| 159 GC_PLUGIN_IGNORE("http://crbug.com/383741") | 160 GC_PLUGIN_IGNORE("http://crbug.com/383741") |
| 160 Persistent<Element> m_keepAlive; | 161 Persistent<Element> m_keepAlive; |
| 161 | 162 |
| 162 Timer<ImageLoader> m_derefElementTimer; | 163 Timer<ImageLoader> m_derefElementTimer; |
| 163 AtomicString m_failedLoadURL; | 164 AtomicString m_failedLoadURL; |
| 164 WeakPtr<Task> m_pendingTask; // owned by Microtask | 165 WeakPtr<Task> m_pendingTask; // owned by Microtask |
| 165 std::unique_ptr<IncrementLoadEventDelayCount> m_loadDelayCounter; | 166 std::unique_ptr<IncrementLoadEventDelayCount> m_loadDelayCounter; |
|
kouhei (in TOK)
2017/03/15 11:32:34
m_delayLoadUntilUpdateFromElement?
hiroshige
2017/05/04 22:50:50
Done.
| |
| 167 | |
| 168 // Delaying load event: the timeline should be: | |
| 169 // (0) ImageResource::fetch() is called. | |
| 170 // (1) ResourceFetcher::startLoad(): Resource loading is actually started. | |
| 171 // (2) ResourceLoader::didFinishLoading() etc: | |
| 172 // Resource loading is finished, but SVG document load might be | |
| 173 // incomplete because of asynchronously loaded subresources. | |
| 174 // (3) imageNotifyFinished(): Image is completely loaded. | |
| 175 // and we must delay Document load event from (1) to (3). | |
| 176 // - |ResourceFetcher::m_loaders| delays Document load event from (1) to (2). | |
| 177 // - |m_loadDelayCounter| delays Document load event from the first | |
| 178 // imageChanged() (at some time between (1) and (2)) until (3). | |
| 179 // Ideally, we might want |m_loadDelayCounter2| to delay Document load event | |
| 180 // from (1) to (3), but currently we piggybacked on imageChanged() because | |
| 181 // adding a callback hook at (1) might complicate the code. | |
| 182 std::unique_ptr<IncrementLoadEventDelayCount> m_loadDelayCounter2; | |
|
kouhei (in TOK)
2017/03/15 11:32:34
Do we have a better name for this?
m_delayLoadUnti
fs
2017/03/15 14:22:17
Anything other than ...2 would be an improvement I
hiroshige
2017/05/04 22:50:50
Done.
| |
| 183 | |
| 166 bool m_hasPendingLoadEvent : 1; | 184 bool m_hasPendingLoadEvent : 1; |
| 167 bool m_hasPendingErrorEvent : 1; | 185 bool m_hasPendingErrorEvent : 1; |
| 168 bool m_imageComplete : 1; | 186 bool m_imageComplete : 1; |
| 169 bool m_loadingImageDocument : 1; | 187 bool m_loadingImageDocument : 1; |
| 170 bool m_elementIsProtected : 1; | 188 bool m_elementIsProtected : 1; |
| 171 bool m_suppressErrorEvents : 1; | 189 bool m_suppressErrorEvents : 1; |
| 172 }; | 190 }; |
| 173 | 191 |
| 174 } // namespace blink | 192 } // namespace blink |
| 175 | 193 |
| 176 #endif | 194 #endif |
| OLD | NEW |