Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> | 3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> |
| 4 * Copyright (C) 2008, Google Inc. All rights reserved. | 4 * Copyright (C) 2008, Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::Gamm aAndColorProfileOption gammaAndColorProfileOption) | 40 ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::Gamm aAndColorProfileOption gammaAndColorProfileOption) |
| 41 : m_alphaOption(alphaOption) | 41 : m_alphaOption(alphaOption) |
| 42 , m_gammaAndColorProfileOption(gammaAndColorProfileOption) | 42 , m_gammaAndColorProfileOption(gammaAndColorProfileOption) |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 ImageSource::~ImageSource() | 46 ImageSource::~ImageSource() |
| 47 { | 47 { |
| 48 clear(true); | |
| 49 } | 48 } |
| 50 | 49 |
| 51 void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer* data, bool allDataReceived) | 50 size_t ImageSource::clearCacheExceptFrame(size_t clearExceptFrame) |
| 52 { | 51 { |
| 53 if (!destroyAll) { | 52 if (m_decoder) |
|
Peter Kasting
2013/05/29 02:02:18
Nit: Simpler:
return m_decoder ? m_decoder->c
Xianzhu
2013/05/29 18:37:01
Done.
| |
| 54 if (m_decoder) | 53 return m_decoder->clearCacheExceptFrame(clearExceptFrame); |
| 55 m_decoder->clearFrameBufferCache(clearBeforeFrame); | 54 return 0; |
| 56 return; | |
| 57 } | |
| 58 | |
| 59 m_decoder.clear(); | |
| 60 if (data) | |
| 61 setData(data, allDataReceived); | |
| 62 } | 55 } |
| 63 | 56 |
| 64 bool ImageSource::initialized() const | 57 bool ImageSource::initialized() const |
| 65 { | 58 { |
| 66 return m_decoder; | 59 return m_decoder; |
| 67 } | 60 } |
| 68 | 61 |
| 69 void ImageSource::setData(SharedBuffer* data, bool allDataReceived) | 62 void ImageSource::setData(SharedBuffer* data, bool allDataReceived) |
| 70 { | 63 { |
| 71 // Make the decoder by sniffing the bytes. | 64 // Make the decoder by sniffing the bytes. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 return m_decoder->frameBytesAtIndex(index); | 175 return m_decoder->frameBytesAtIndex(index); |
| 183 } | 176 } |
| 184 | 177 |
| 185 void ImageSource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 178 void ImageSource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
| 186 { | 179 { |
| 187 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); | 180 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); |
| 188 info.addMember(m_decoder, "decoder"); | 181 info.addMember(m_decoder, "decoder"); |
| 189 } | 182 } |
| 190 | 183 |
| 191 } | 184 } |
| OLD | NEW |