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

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: style 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 Image::SizeAvailability BitmapImage::setData(PassRefPtr<SharedBuffer> data, 198 Image::SizeAvailability BitmapImage::setData(PassRefPtr<SharedBuffer> data,
199 bool allDataReceived) { 199 bool allDataReceived) {
200 if (!data.get()) 200 if (!data.get())
201 return SizeAvailable; 201 return SizeAvailable;
202 202
203 int length = data->size(); 203 int length = data->size();
204 if (!length) 204 if (!length)
205 return SizeAvailable; 205 return SizeAvailable;
206 206
207 // If ImageSource::setData() fails, we know that this is a decode error. 207 // If ImageSource::setData() fails, we know that this is a decode error.
208 // Report size available so that it gets registered as such in ImageResource. 208 // Report size available so that it gets registered as such in
209 // ImageResourceContent.
209 if (!m_source.setData(std::move(data), allDataReceived)) 210 if (!m_source.setData(std::move(data), allDataReceived))
210 return SizeAvailable; 211 return SizeAvailable;
211 212
212 return dataChanged(allDataReceived); 213 return dataChanged(allDataReceived);
213 } 214 }
214 215
215 Image::SizeAvailability BitmapImage::dataChanged(bool allDataReceived) { 216 Image::SizeAvailability BitmapImage::dataChanged(bool allDataReceived) {
216 TRACE_EVENT0("blink", "BitmapImage::dataChanged"); 217 TRACE_EVENT0("blink", "BitmapImage::dataChanged");
217 218
218 // Clear all partially-decoded frames. For most image formats, there is only 219 // Clear all partially-decoded frames. For most image formats, there is only
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 getImageObserver()->animationAdvanced(this); 652 getImageObserver()->animationAdvanced(this);
652 653
653 return true; 654 return true;
654 } 655 }
655 656
656 void BitmapImage::notifyObserversOfAnimationAdvance(TimerBase*) { 657 void BitmapImage::notifyObserversOfAnimationAdvance(TimerBase*) {
657 getImageObserver()->animationAdvanced(this); 658 getImageObserver()->animationAdvanced(this);
658 } 659 }
659 660
660 } // namespace blink 661 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698