OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void ImageResource::markClientsAndObserversFinished() | 108 void ImageResource::markClientsAndObserversFinished() |
109 { | 109 { |
110 HashCountedSet<ImageResourceObserver*> observers; | 110 HashCountedSet<ImageResourceObserver*> observers; |
111 m_observers.swap(observers); | 111 m_observers.swap(observers); |
112 for (const auto& it : observers) | 112 for (const auto& it : observers) |
113 m_finishedObservers.add(it.key, it.value); | 113 m_finishedObservers.add(it.key, it.value); |
114 | 114 |
115 Resource::markClientsAndObserversFinished(); | 115 Resource::markClientsAndObserversFinished(); |
116 } | 116 } |
117 | 117 |
| 118 void ImageResource::ensureImage() |
| 119 { |
| 120 if (m_data && !m_image && !errorOccurred()) { |
| 121 createImage(); |
| 122 m_image->setData(m_data, true); |
| 123 } |
| 124 } |
| 125 |
| 126 void ImageResource::didAddClient(ResourceClient* client) |
| 127 { |
| 128 ensureImage(); |
| 129 Resource::didAddClient(client); |
| 130 } |
| 131 |
118 void ImageResource::addObserver(ImageResourceObserver* observer) | 132 void ImageResource::addObserver(ImageResourceObserver* observer) |
119 { | 133 { |
120 willAddClientOrObserver(); | 134 willAddClientOrObserver(); |
121 | 135 |
122 m_observers.add(observer); | 136 m_observers.add(observer); |
123 | 137 |
124 if (isCacheValidator()) | 138 if (isCacheValidator()) |
125 return; | 139 return; |
126 | 140 |
127 if (m_data && !m_image && !errorOccurred()) { | 141 ensureImage(); |
128 createImage(); | |
129 m_image->setData(m_data, true); | |
130 } | |
131 | 142 |
132 if (m_image && !m_image->isNull()) { | 143 if (m_image && !m_image->isNull()) { |
133 observer->imageChanged(this); | 144 observer->imageChanged(this); |
134 } | 145 } |
135 | 146 |
136 if (isLoaded()) { | 147 if (isLoaded()) { |
137 observer->imageNotifyFinished(this); | 148 observer->imageNotifyFinished(this); |
138 if (m_observers.contains(observer)) { | 149 if (m_observers.contains(observer)) { |
139 m_finishedObservers.add(observer); | 150 m_finishedObservers.add(observer); |
140 m_observers.remove(observer); | 151 m_observers.remove(observer); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 if (response().wasFetchedViaServiceWorker()) | 575 if (response().wasFetchedViaServiceWorker()) |
565 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; | 576 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; |
566 if (!getImage()->currentFrameHasSingleSecurityOrigin()) | 577 if (!getImage()->currentFrameHasSingleSecurityOrigin()) |
567 return false; | 578 return false; |
568 if (passesAccessControlCheck(securityOrigin)) | 579 if (passesAccessControlCheck(securityOrigin)) |
569 return true; | 580 return true; |
570 return !securityOrigin->taintsCanvas(response().url()); | 581 return !securityOrigin->taintsCanvas(response().url()); |
571 } | 582 } |
572 | 583 |
573 } // namespace blink | 584 } // namespace blink |
OLD | NEW |