| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 prepareLazyDecodedFrames(); | 158 prepareLazyDecodedFrames(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 if (m_frameGenerator) { | 161 if (m_frameGenerator) { |
| 162 if (!m_rwBuffer) | 162 if (!m_rwBuffer) |
| 163 m_rwBuffer = wrapUnique(new SkRWBuffer(data->size())); | 163 m_rwBuffer = wrapUnique(new SkRWBuffer(data->size())); |
| 164 | 164 |
| 165 const char* segment = 0; | 165 const char* segment = 0; |
| 166 for (size_t length = data->getSomeData(segment, m_rwBuffer->size()); length; | 166 for (size_t length = data->getSomeData(segment, m_rwBuffer->size()); length; |
| 167 length = data->getSomeData(segment, m_rwBuffer->size())) { | 167 length = data->getSomeData(segment, m_rwBuffer->size())) { |
| 168 m_rwBuffer->append(segment, length); | 168 DCHECK_GE(data->size(), m_rwBuffer->size() + length); |
| 169 const size_t remaining = data->size() - m_rwBuffer->size() - length; |
| 170 m_rwBuffer->append(segment, length, remaining); |
| 169 } | 171 } |
| 170 } | 172 } |
| 171 } | 173 } |
| 172 | 174 |
| 173 bool DeferredImageDecoder::isSizeAvailable() { | 175 bool DeferredImageDecoder::isSizeAvailable() { |
| 174 // m_actualDecoder is 0 only if image decoding is deferred and that means | 176 // m_actualDecoder is 0 only if image decoding is deferred and that means |
| 175 // the image header decoded successfully and the size is available. | 177 // the image header decoded successfully and the size is available. |
| 176 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; | 178 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; |
| 177 } | 179 } |
| 178 | 180 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 363 |
| 362 namespace WTF { | 364 namespace WTF { |
| 363 template <> | 365 template <> |
| 364 struct VectorTraits<blink::DeferredFrameData> | 366 struct VectorTraits<blink::DeferredFrameData> |
| 365 : public SimpleClassVectorTraits<blink::DeferredFrameData> { | 367 : public SimpleClassVectorTraits<blink::DeferredFrameData> { |
| 366 STATIC_ONLY(VectorTraits); | 368 STATIC_ONLY(VectorTraits); |
| 367 static const bool canInitializeWithMemset = | 369 static const bool canInitializeWithMemset = |
| 368 false; // Not all DeferredFrameData members initialize to 0. | 370 false; // Not all DeferredFrameData members initialize to 0. |
| 369 }; | 371 }; |
| 370 } | 372 } |
| OLD | NEW |