OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 : m_decoder(0) | 93 : m_decoder(0) |
94 {} | 94 {} |
95 | 95 |
96 ImageSource::~ImageSource() | 96 ImageSource::~ImageSource() |
97 { | 97 { |
98 clear(true); | 98 clear(true); |
99 } | 99 } |
100 | 100 |
101 void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer*
data, bool allDataReceived) | 101 void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer*
data, bool allDataReceived) |
102 { | 102 { |
103 // TODO(darin): Figure out what to do with the |data| and |allDataReceived|
params. | 103 if (!destroyAll) { |
104 | 104 if (m_decoder) |
105 if (destroyAll) { | 105 m_decoder->clearFrameBufferCache(clearBeforeFrame); |
106 delete m_decoder; | |
107 m_decoder = 0; | |
108 return; | 106 return; |
109 } | 107 } |
110 | 108 |
111 if (m_decoder) | 109 delete m_decoder; |
112 m_decoder->clearFrameBufferCache(clearBeforeFrame); | 110 m_decoder = 0; |
| 111 if (data) |
| 112 setData(data, allDataReceived); |
113 } | 113 } |
114 | 114 |
115 bool ImageSource::initialized() const | 115 bool ImageSource::initialized() const |
116 { | 116 { |
117 return m_decoder; | 117 return m_decoder; |
118 } | 118 } |
119 | 119 |
120 void ImageSource::setData(SharedBuffer* data, bool allDataReceived) | 120 void ImageSource::setData(SharedBuffer* data, bool allDataReceived) |
121 { | 121 { |
122 // Make the decoder by sniffing the bytes. | 122 // Make the decoder by sniffing the bytes. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 ImageSource::setData(data, allDataReceived); | 239 ImageSource::setData(data, allDataReceived); |
240 } | 240 } |
241 | 241 |
242 String ImageSource::filenameExtension() const | 242 String ImageSource::filenameExtension() const |
243 { | 243 { |
244 return m_decoder ? m_decoder->filenameExtension() : String(); | 244 return m_decoder ? m_decoder->filenameExtension() : String(); |
245 } | 245 } |
246 | 246 |
247 } | 247 } |
OLD | NEW |