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

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

Issue 1493633004: Make platform/image-decoders to use USING_FAST_MALLOC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * 3 *
4 * Portions are Copyright (C) 2001-6 mozilla.org 4 * Portions are Copyright (C) 2001-6 mozilla.org
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Stuart Parmenter <stuart@mozilla.com> 7 * Stuart Parmenter <stuart@mozilla.com>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const int exifMarker = JPEG_APP0 + 1; 75 const int exifMarker = JPEG_APP0 + 1;
76 76
77 // JPEG only supports a denominator of 8. 77 // JPEG only supports a denominator of 8.
78 const unsigned scaleDenominator = 8; 78 const unsigned scaleDenominator = 8;
79 79
80 } // namespace 80 } // namespace
81 81
82 namespace blink { 82 namespace blink {
83 83
84 struct decoder_error_mgr { 84 struct decoder_error_mgr {
85 DISALLOW_NEW();
85 struct jpeg_error_mgr pub; // "public" fields for IJG library 86 struct jpeg_error_mgr pub; // "public" fields for IJG library
86 int num_corrupt_warnings; // Counts corrupt warning messages 87 int num_corrupt_warnings; // Counts corrupt warning messages
87 jmp_buf setjmp_buffer; // For handling catastropic errors 88 jmp_buf setjmp_buffer; // For handling catastropic errors
88 }; 89 };
89 90
90 struct decoder_source_mgr { 91 struct decoder_source_mgr {
92 DISALLOW_NEW();
91 struct jpeg_source_mgr pub; // "public" fields for IJG library 93 struct jpeg_source_mgr pub; // "public" fields for IJG library
92 JPEGImageReader* reader; 94 JPEGImageReader* reader;
93 }; 95 };
94 96
95 enum jstate { 97 enum jstate {
96 JPEG_HEADER, // Reading JFIF headers 98 JPEG_HEADER, // Reading JFIF headers
97 JPEG_START_DECOMPRESS, 99 JPEG_START_DECOMPRESS,
98 JPEG_DECOMPRESS_PROGRESSIVE, // Output progressive pixels 100 JPEG_DECOMPRESS_PROGRESSIVE, // Output progressive pixels
99 JPEG_DECOMPRESS_SEQUENTIAL, // Output sequential pixels 101 JPEG_DECOMPRESS_SEQUENTIAL, // Output sequential pixels
100 JPEG_DONE 102 JPEG_DONE
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return YUV_410; 284 return YUV_410;
283 default: 285 default:
284 break; 286 break;
285 } 287 }
286 } 288 }
287 } 289 }
288 290
289 return YUV_UNKNOWN; 291 return YUV_UNKNOWN;
290 } 292 }
291 293
292 class JPEGImageReader { 294 class JPEGImageReader final {
293 USING_FAST_MALLOC(JPEGImageReader); 295 USING_FAST_MALLOC(JPEGImageReader);
296 WTF_MAKE_NONCOPYABLE(JPEGImageReader);
294 public: 297 public:
295 JPEGImageReader(JPEGImageDecoder* decoder) 298 JPEGImageReader(JPEGImageDecoder* decoder)
296 : m_decoder(decoder) 299 : m_decoder(decoder)
297 , m_needsRestart(false) 300 , m_needsRestart(false)
298 , m_restartPosition(0) 301 , m_restartPosition(0)
299 , m_nextReadPosition(0) 302 , m_nextReadPosition(0)
300 , m_lastSetByte(nullptr) 303 , m_lastSetByte(nullptr)
301 , m_state(JPEG_HEADER) 304 , m_state(JPEG_HEADER)
302 , m_samples(nullptr) 305 , m_samples(nullptr)
303 #if USE(QCMSLIB) 306 #if USE(QCMSLIB)
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 // has failed. 1063 // has failed.
1061 if (!m_reader->decode(onlySize) && isAllDataReceived()) 1064 if (!m_reader->decode(onlySize) && isAllDataReceived())
1062 setFailed(); 1065 setFailed();
1063 1066
1064 // If decoding is done or failed, we don't need the JPEGImageReader anymore. 1067 // If decoding is done or failed, we don't need the JPEGImageReader anymore.
1065 if (isComplete(this, onlySize) || failed()) 1068 if (isComplete(this, onlySize) || failed())
1066 m_reader.clear(); 1069 m_reader.clear();
1067 } 1070 }
1068 1071
1069 } 1072 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698