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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2175163002: Merge "Ensure |m_image| is (re-)created in ImageResource::didAddClient()" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Fix merge error Created 4 years, 4 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) 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 HashCountedSet<ImageResourceObserver*>::iterator it = m_observers.begin( ); 110 HashCountedSet<ImageResourceObserver*>::iterator it = m_observers.begin( );
111 for (int i = it->value; i; i--) { 111 for (int i = it->value; i; i--) {
112 m_finishedObservers.add(it->key); 112 m_finishedObservers.add(it->key);
113 m_observers.remove(it); 113 m_observers.remove(it);
114 } 114 }
115 } 115 }
116 116
117 Resource::markClientsAndObserversFinished(); 117 Resource::markClientsAndObserversFinished();
118 } 118 }
119 119
120 void ImageResource::ensureImage()
121 {
122 if (m_data && !m_image && !errorOccurred()) {
123 createImage();
124 m_image->setData(m_data, true);
125 }
126 }
127
128 void ImageResource::didAddClient(ResourceClient* client)
129 {
130 ensureImage();
131 Resource::didAddClient(client);
132 }
133
120 void ImageResource::addObserver(ImageResourceObserver* observer) 134 void ImageResource::addObserver(ImageResourceObserver* observer)
121 { 135 {
122 willAddClientOrObserver(); 136 willAddClientOrObserver();
123 137
124 m_observers.add(observer); 138 m_observers.add(observer);
125 139
126 if (!m_revalidatingRequest.isNull()) 140 if (!m_revalidatingRequest.isNull())
127 return; 141 return;
128 142
129 if (m_data && !m_image && !errorOccurred()) { 143 ensureImage();
130 createImage();
131 m_image->setData(m_data, true);
132 }
133 144
134 if (m_image && !m_image->isNull()) { 145 if (m_image && !m_image->isNull()) {
135 observer->imageChanged(this); 146 observer->imageChanged(this);
136 } 147 }
137 148
138 if (isLoaded()) { 149 if (isLoaded()) {
139 observer->imageNotifyFinished(this); 150 observer->imageNotifyFinished(this);
140 if (m_observers.contains(observer)) { 151 if (m_observers.contains(observer)) {
141 m_finishedObservers.add(observer); 152 m_finishedObservers.add(observer);
142 m_observers.remove(observer); 153 m_observers.remove(observer);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 if (response().wasFetchedViaServiceWorker()) 579 if (response().wasFetchedViaServiceWorker())
569 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 580 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
570 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 581 if (!getImage()->currentFrameHasSingleSecurityOrigin())
571 return false; 582 return false;
572 if (passesAccessControlCheck(securityOrigin)) 583 if (passesAccessControlCheck(securityOrigin))
573 return true; 584 return true;
574 return !securityOrigin->taintsCanvas(response().url()); 585 return !securityOrigin->taintsCanvas(response().url());
575 } 586 }
576 587
577 } // namespace blink 588 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698