OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "platform/image-decoders/FastSharedBufferReader.h" | 31 #include "platform/image-decoders/FastSharedBufferReader.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 FastSharedBufferReader::FastSharedBufferReader(PassRefPtr<SegmentReader> data) | 35 FastSharedBufferReader::FastSharedBufferReader(PassRefPtr<SegmentReader> data) |
36 : m_data(data), m_segment(0), m_segmentLength(0), m_dataPosition(0) {} | 36 : m_data(std::move(data)), |
| 37 m_segment(0), |
| 38 m_segmentLength(0), |
| 39 m_dataPosition(0) {} |
37 | 40 |
38 void FastSharedBufferReader::setData(PassRefPtr<SegmentReader> data) { | 41 void FastSharedBufferReader::setData(PassRefPtr<SegmentReader> data) { |
39 if (data == m_data) | 42 if (data == m_data) |
40 return; | 43 return; |
41 m_data = data; | 44 m_data = data; |
42 clearCache(); | 45 clearCache(); |
43 } | 46 } |
44 | 47 |
45 void FastSharedBufferReader::clearCache() { | 48 void FastSharedBufferReader::clearCache() { |
46 m_segment = 0; | 49 m_segment = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return m_segmentLength; | 86 return m_segmentLength; |
84 } | 87 } |
85 | 88 |
86 void FastSharedBufferReader::getSomeDataInternal(size_t dataPosition) const { | 89 void FastSharedBufferReader::getSomeDataInternal(size_t dataPosition) const { |
87 m_dataPosition = dataPosition; | 90 m_dataPosition = dataPosition; |
88 m_segmentLength = m_data->getSomeData(m_segment, dataPosition); | 91 m_segmentLength = m_data->getSomeData(m_segment, dataPosition); |
89 DCHECK(m_segmentLength); | 92 DCHECK(m_segmentLength); |
90 } | 93 } |
91 | 94 |
92 } // namespace blink | 95 } // namespace blink |
OLD | NEW |