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

Side by Side Diff: Source/core/platform/graphics/DeferredImageDecoder.h

Issue 105773003: Teach Skia to use discardable memory (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class DeferredImageDecoder { 42 class DeferredImageDecoder {
43 public: 43 public:
44 ~DeferredImageDecoder(); 44 ~DeferredImageDecoder();
45 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima geSource::AlphaOption, ImageSource::GammaAndColorProfileOption); 45 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima geSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
46 46
47 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec oder>); 47 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec oder>);
48 48
49 static bool isLazyDecoded(const SkBitmap&); 49 static bool isLazyDecoded(const SkBitmap&);
50 50
51 static void setEnabled(bool); 51 static void setEnabled(bool);
52 static void setEnabledSkiaDiscardableMemory(bool);
Stephen White 2013/12/05 21:52:14 Nit: kind of awkward. Could this be setSkiaDiscard
Alpha Left Google 2013/12/08 00:30:11 Done.
52 53
53 String filenameExtension() const; 54 String filenameExtension() const;
54 55
55 ImageFrame* frameBufferAtIndex(size_t index); 56 ImageFrame* frameBufferAtIndex(size_t index);
56 57
57 void setData(SharedBuffer* data, bool allDataReceived); 58 void setData(SharedBuffer* data, bool allDataReceived);
58 59
59 bool isSizeAvailable(); 60 bool isSizeAvailable();
60 IntSize size() const; 61 IntSize size() const;
61 IntSize frameSizeAtIndex(size_t index) const; 62 IntSize frameSizeAtIndex(size_t index) const;
62 size_t frameCount(); 63 size_t frameCount();
63 int repetitionCount() const; 64 int repetitionCount() const;
64 size_t clearCacheExceptFrame(size_t); 65 size_t clearCacheExceptFrame(size_t);
65 bool frameHasAlphaAtIndex(size_t index) const; 66 bool frameHasAlphaAtIndex(size_t index) const;
66 bool frameIsCompleteAtIndex(size_t) const; 67 bool frameIsCompleteAtIndex(size_t) const;
67 float frameDurationAtIndex(size_t) const; 68 float frameDurationAtIndex(size_t) const;
68 unsigned frameBytesAtIndex(size_t index) const; 69 unsigned frameBytesAtIndex(size_t index) const;
69 ImageOrientation orientation() const; 70 ImageOrientation orientation() const;
70 bool hotSpot(IntPoint&) const; 71 bool hotSpot(IntPoint&) const;
71 72
72 // For testing. 73 // For testing.
73 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } 74 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); }
74 75
75 private: 76 private:
76 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); 77 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder);
77 void prepareLazyDecodedFrames(); 78 void prepareLazyDecodedFrames();
79 SkBitmap createBitmap(size_t index);
80 SkBitmap createSkiaDiscardableBitmap(size_t index);
78 SkBitmap createLazyDecodingBitmap(size_t index); 81 SkBitmap createLazyDecodingBitmap(size_t index);
79 void activateLazyDecoding(); 82 void activateLazyDecoding();
80 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); 83 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived);
81 84
82 RefPtr<SharedBuffer> m_data; 85 RefPtr<SharedBuffer> m_data;
83 bool m_allDataReceived; 86 bool m_allDataReceived;
84 OwnPtr<ImageDecoder> m_actualDecoder; 87 OwnPtr<ImageDecoder> m_actualDecoder;
85 88
86 String m_filenameExtension; 89 String m_filenameExtension;
87 IntSize m_size; 90 IntSize m_size;
88 ImageOrientation m_orientation; 91 ImageOrientation m_orientation;
89 int m_repetitionCount; 92 int m_repetitionCount;
90 93
91 Vector<OwnPtr<ImageFrame> > m_lazyDecodedFrames; 94 Vector<OwnPtr<ImageFrame> > m_lazyDecodedFrames;
92 RefPtr<ImageFrameGenerator> m_frameGenerator; 95 RefPtr<ImageFrameGenerator> m_frameGenerator;
93 96
94 static bool s_enabled; 97 static bool s_enabled;
98 static bool s_enabledSkiaDiscardableMemory;
95 }; 99 };
96 100
97 } // namespace WebCore 101 } // namespace WebCore
98 102
99 #endif 103 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698