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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp

Issue 2469873002: [ImageResource 4] Split ImageResource into Resource and Image parts (Closed)
Patch Set: comments Created 4 years 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 Image::SizeAvailability BitmapImage::setData(PassRefPtr<SharedBuffer> data, 179 Image::SizeAvailability BitmapImage::setData(PassRefPtr<SharedBuffer> data,
180 bool allDataReceived) { 180 bool allDataReceived) {
181 if (!data.get()) 181 if (!data.get())
182 return SizeAvailable; 182 return SizeAvailable;
183 183
184 int length = data->size(); 184 int length = data->size();
185 if (!length) 185 if (!length)
186 return SizeAvailable; 186 return SizeAvailable;
187 187
188 // If ImageSource::setData() fails, we know that this is a decode error. 188 // If ImageSource::setData() fails, we know that this is a decode error.
189 // Report size available so that it gets registered as such in ImageResource. 189 // Report size available so that it gets registered as such in
190 // ImageResourceContent.
190 if (!m_source.setData(std::move(data), allDataReceived)) 191 if (!m_source.setData(std::move(data), allDataReceived))
191 return SizeAvailable; 192 return SizeAvailable;
192 193
193 return dataChanged(allDataReceived); 194 return dataChanged(allDataReceived);
194 } 195 }
195 196
196 Image::SizeAvailability BitmapImage::dataChanged(bool allDataReceived) { 197 Image::SizeAvailability BitmapImage::dataChanged(bool allDataReceived) {
197 TRACE_EVENT0("blink", "BitmapImage::dataChanged"); 198 TRACE_EVENT0("blink", "BitmapImage::dataChanged");
198 199
199 // Clear all partially-decoded frames. For most image formats, there is only 200 // Clear all partially-decoded frames. For most image formats, there is only
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 getImageObserver()->animationAdvanced(this); 622 getImageObserver()->animationAdvanced(this);
622 623
623 return true; 624 return true;
624 } 625 }
625 626
626 void BitmapImage::notifyObserversOfAnimationAdvance(TimerBase*) { 627 void BitmapImage::notifyObserversOfAnimationAdvance(TimerBase*) {
627 getImageObserver()->animationAdvanced(this); 628 getImageObserver()->animationAdvanced(this);
628 } 629 }
629 630
630 } // namespace blink 631 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698