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

Side by Side Diff: Source/core/platform/image-decoders/ImageDecoder.cpp

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008-2009 Torch Mobile, Inc. 2 * Copyright (C) 2008-2009 Torch Mobile, Inc.
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "ImageDecoder.h" 23 #include "ImageDecoder.h"
24 24
25 #include "BMPImageDecoder.h" 25 #include "BMPImageDecoder.h"
26 #include "GIFImageDecoder.h" 26 #include "GIFImageDecoder.h"
27 #include "ICOImageDecoder.h" 27 #include "ICOImageDecoder.h"
28 #include "JPEGImageDecoder.h" 28 #include "JPEGImageDecoder.h"
29 #include "PNGImageDecoder.h" 29 #include "PNGImageDecoder.h"
30 #include "PlatformMemoryInstrumentation.h"
31 #include "SharedBuffer.h" 30 #include "SharedBuffer.h"
32 #include "WEBPImageDecoder.h" 31 #include "WEBPImageDecoder.h"
33 32
34 #include <algorithm> 33 #include <algorithm>
35 #include <cmath> 34 #include <cmath>
36 #include <wtf/MemoryInstrumentationVector.h>
37 35
38 using namespace std; 36 using namespace std;
39 37
40 namespace WebCore { 38 namespace WebCore {
41 39
42 static unsigned copyFromSharedBuffer(char* buffer, unsigned bufferLength, const SharedBuffer& sharedBuffer, unsigned offset) 40 static unsigned copyFromSharedBuffer(char* buffer, unsigned bufferLength, const SharedBuffer& sharedBuffer, unsigned offset)
43 { 41 {
44 unsigned bytesExtracted = 0; 42 unsigned bytesExtracted = 0;
45 const char* moreData; 43 const char* moreData;
46 while (unsigned moreDataLength = sharedBuffer.getSomeData(moreData, offset)) { 44 while (unsigned moreDataLength = sharedBuffer.getSomeData(moreData, offset)) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 126 }
129 127
130 unsigned ImageDecoder::frameBytesAtIndex(size_t index) const 128 unsigned ImageDecoder::frameBytesAtIndex(size_t index) const
131 { 129 {
132 if (m_frameBufferCache.size() <= index) 130 if (m_frameBufferCache.size() <= index)
133 return 0; 131 return 0;
134 // FIXME: Use the dimension of the requested frame. 132 // FIXME: Use the dimension of the requested frame.
135 return m_size.area() * sizeof(ImageFrame::PixelData); 133 return m_size.area() * sizeof(ImageFrame::PixelData);
136 } 134 }
137 135
138 void ImageDecoder::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
139 {
140 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
141 info.addMember(m_data, "data");
142 info.addMember(m_frameBufferCache, "frameBufferCache");
143 info.addMember(m_colorProfile, "colorProfile");
144 info.addMember(m_scaledColumns, "scaledColumns");
145 info.addMember(m_scaledRows, "scaledRows");
146 }
147
148 enum MatchType { 136 enum MatchType {
149 Exact, 137 Exact,
150 UpperBound, 138 UpperBound,
151 LowerBound 139 LowerBound
152 }; 140 };
153 141
154 inline void fillScaledValues(Vector<int>& scaledValues, double scaleRate, int le ngth) 142 inline void fillScaledValues(Vector<int>& scaledValues, double scaleRate, int le ngth)
155 { 143 {
156 double inflateRate = 1. / scaleRate; 144 double inflateRate = 1. / scaleRate;
157 scaledValues.reserveCapacity(static_cast<int>(length * scaleRate + 0.5)); 145 scaledValues.reserveCapacity(static_cast<int>(length * scaleRate + 0.5));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 { 207 {
220 return getScaledValue<LowerBound>(m_scaledRows, origY, searchStart); 208 return getScaledValue<LowerBound>(m_scaledRows, origY, searchStart);
221 } 209 }
222 210
223 int ImageDecoder::scaledY(int origY, int searchStart) 211 int ImageDecoder::scaledY(int origY, int searchStart)
224 { 212 {
225 return getScaledValue<Exact>(m_scaledRows, origY, searchStart); 213 return getScaledValue<Exact>(m_scaledRows, origY, searchStart);
226 } 214 }
227 215
228 } // namespace WebCore 216 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/image-decoders/ImageDecoder.h ('k') | Source/core/platform/image-decoders/skia/ImageDecoderSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698