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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/FastSharedBufferReader.cpp

Issue 1812273003: Eliminate copies of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 months 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) 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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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<SharedBuffer> data) 35 FastSharedBufferReader::FastSharedBufferReader(PassRefPtr<SegmentReader> data)
36 : m_data(data) 36 : m_data(data)
37 , m_segment(0) 37 , m_segment(0)
38 , m_segmentLength(0) 38 , m_segmentLength(0)
39 , m_dataPosition(0) 39 , m_dataPosition(0)
40 { 40 {
41 } 41 }
42 42
43 void FastSharedBufferReader::setData(PassRefPtr<SharedBuffer> data) 43 void FastSharedBufferReader::setData(PassRefPtr<SegmentReader> data)
44 { 44 {
45 if (data == m_data) 45 if (data == m_data)
46 return; 46 return;
47 m_data = data; 47 m_data = data;
48 clearCache(); 48 clearCache();
49 } 49 }
50 50
51 void FastSharedBufferReader::clearCache() 51 void FastSharedBufferReader::clearCache()
52 { 52 {
53 m_segment = 0; 53 m_segment = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 void FastSharedBufferReader::getSomeDataInternal(size_t dataPosition) const 91 void FastSharedBufferReader::getSomeDataInternal(size_t dataPosition) const
92 { 92 {
93 m_dataPosition = dataPosition; 93 m_dataPosition = dataPosition;
94 m_segmentLength = m_data->getSomeData(m_segment, dataPosition); 94 m_segmentLength = m_data->getSomeData(m_segment, dataPosition);
95 ASSERT(m_segmentLength); 95 ASSERT(m_segmentLength);
96 } 96 }
97 97
98 } // namespace blink 98 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698