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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h

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 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK ***** 2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * 4 *
5 * The contents of this file are subject to the Mozilla Public License Version 5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with 6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at 7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/ 8 * http://www.mozilla.org/MPL/
9 * 9 *
10 * Software distributed under the License is distributed on an "AS IS" basis, 10 * Software distributed under the License is distributed on an "AS IS" basis,
(...skipping 22 matching lines...) Expand all
33 * the provisions above, a recipient may use your version of this file under 33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL. 34 * the terms of any one of the MPL, the GPL or the LGPL.
35 * 35 *
36 * ***** END LICENSE BLOCK ***** */ 36 * ***** END LICENSE BLOCK ***** */
37 37
38 #ifndef GIFImageReader_h 38 #ifndef GIFImageReader_h
39 #define GIFImageReader_h 39 #define GIFImageReader_h
40 40
41 // Define ourselves as the clientPtr. Mozilla just hacked their C++ callback cl ass into this old C decoder, 41 // Define ourselves as the clientPtr. Mozilla just hacked their C++ callback cl ass into this old C decoder,
42 // so we will too. 42 // so we will too.
43 #include "platform/SharedBuffer.h"
44 #include "platform/image-decoders/FastSharedBufferReader.h" 43 #include "platform/image-decoders/FastSharedBufferReader.h"
45 #include "platform/image-decoders/gif/GIFImageDecoder.h" 44 #include "platform/image-decoders/gif/GIFImageDecoder.h"
46 #include "wtf/Allocator.h" 45 #include "wtf/Allocator.h"
47 #include "wtf/Noncopyable.h" 46 #include "wtf/Noncopyable.h"
48 #include "wtf/OwnPtr.h" 47 #include "wtf/OwnPtr.h"
49 #include "wtf/PassOwnPtr.h" 48 #include "wtf/PassOwnPtr.h"
50 #include "wtf/Vector.h" 49 #include "wtf/Vector.h"
51 50
52 #define MAX_DICTIONARY_ENTRY_BITS 12 51 #define MAX_DICTIONARY_ENTRY_BITS 12
53 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS 52 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 , m_sentSizeToClient(false) 291 , m_sentSizeToClient(false)
293 , m_loopCount(cLoopCountNotSeen) 292 , m_loopCount(cLoopCountNotSeen)
294 , m_parseCompleted(false) 293 , m_parseCompleted(false)
295 { 294 {
296 } 295 }
297 296
298 ~GIFImageReader() 297 ~GIFImageReader()
299 { 298 {
300 } 299 }
301 300
302 void setData(PassRefPtr<blink::SharedBuffer> data) { m_data = data; } 301 void setData(PassRefPtr<blink::SegmentReader> data) { m_data = data; }
303 bool parse(blink::GIFImageDecoder::GIFParseQuery); 302 bool parse(blink::GIFImageDecoder::GIFParseQuery);
304 bool decode(size_t frameIndex); 303 bool decode(size_t frameIndex);
305 304
306 size_t imagesCount() const 305 size_t imagesCount() const
307 { 306 {
308 if (m_frames.isEmpty()) 307 if (m_frames.isEmpty())
309 return 0; 308 return 0;
310 309
311 // This avoids counting an empty frame when the file is truncated right after 310 // This avoids counting an empty frame when the file is truncated right after
312 // GIFControlExtension but before GIFImageHeader. 311 // GIFControlExtension but before GIFImageHeader.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Global (multi-image) state. 348 // Global (multi-image) state.
350 int m_version; // Either 89 for GIF89 or 87 for GIF87. 349 int m_version; // Either 89 for GIF89 or 87 for GIF87.
351 unsigned m_screenWidth; // Logical screen width & height. 350 unsigned m_screenWidth; // Logical screen width & height.
352 unsigned m_screenHeight; 351 unsigned m_screenHeight;
353 bool m_sentSizeToClient; 352 bool m_sentSizeToClient;
354 GIFColorMap m_globalColorMap; 353 GIFColorMap m_globalColorMap;
355 int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders. 354 int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders.
356 355
357 Vector<OwnPtr<GIFFrameContext>> m_frames; 356 Vector<OwnPtr<GIFFrameContext>> m_frames;
358 357
359 RefPtr<blink::SharedBuffer> m_data; 358 RefPtr<blink::SegmentReader> m_data;
360 bool m_parseCompleted; 359 bool m_parseCompleted;
361 }; 360 };
362 361
363 #endif 362 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698