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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.h

Issue 1925533003: High CPU and increased memory usage fix for high-res (GIF, WEBP...) animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing. DCHECK. Thanks fmalita@. Created 4 years, 7 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 30 matching lines...) Expand all
41 41
42 class ImageFrameGenerator; 42 class ImageFrameGenerator;
43 43
44 // Implements SkImageGenerator, used by SkPixelRef to populate a discardable mem ory 44 // Implements SkImageGenerator, used by SkPixelRef to populate a discardable mem ory
45 // with a decoded image frame. ImageFrameGenerator does the actual decoding. 45 // with a decoded image frame. ImageFrameGenerator does the actual decoding.
46 // 46 //
47 class PLATFORM_EXPORT DecodingImageGenerator final : public SkImageGenerator { 47 class PLATFORM_EXPORT DecodingImageGenerator final : public SkImageGenerator {
48 USING_FAST_MALLOC(DecodingImageGenerator); 48 USING_FAST_MALLOC(DecodingImageGenerator);
49 WTF_MAKE_NONCOPYABLE(DecodingImageGenerator); 49 WTF_MAKE_NONCOPYABLE(DecodingImageGenerator);
50 public: 50 public:
51 // Make SkImageGenerator::kNeedNewImageUniqueID accessible.
52 enum {
53 kNeedNewImageUniqueID = SkImageGenerator::kNeedNewImageUniqueID
54 };
55
51 static SkImageGenerator* create(SkData*); 56 static SkImageGenerator* create(SkData*);
52 57
53 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, const SkImageInfo&, PassRefPtr<SegmentReader>, bool allDataReceived, size_t index); 58 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, const SkImageInfo&, PassRefPtr<SegmentReader>, bool allDataReceived, size_t index, uint32_t uniqueID = kNeedNewImageUniqueID);
54 ~DecodingImageGenerator() override; 59 ~DecodingImageGenerator() override;
55 60
56 void setCanYUVDecode(bool yes) { m_canYUVDecode = yes; } 61 void setCanYUVDecode(bool yes) { m_canYUVDecode = yes; }
57 62
58 protected: 63 protected:
59 SkData* onRefEncodedData(GrContext* ctx) override; 64 SkData* onRefEncodedData(GrContext* ctx) override;
60 65
61 bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, SkPMColo r table[], int* tableCount) override; 66 bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, SkPMColo r table[], int* tableCount) override;
62 67
63 bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const override; 68 bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const override;
64 69
65 bool onGetYUV8Planes(const SkYUVSizeInfo&, void* planes[3]) override; 70 bool onGetYUV8Planes(const SkYUVSizeInfo&, void* planes[3]) override;
66 71
67 private: 72 private:
68 RefPtr<ImageFrameGenerator> m_frameGenerator; 73 RefPtr<ImageFrameGenerator> m_frameGenerator;
69 const RefPtr<SegmentReader> m_data; // Data source. 74 const RefPtr<SegmentReader> m_data; // Data source.
70 const bool m_allDataReceived; 75 const bool m_allDataReceived;
71 const size_t m_frameIndex; 76 const size_t m_frameIndex;
72 bool m_canYUVDecode; 77 bool m_canYUVDecode;
73 }; 78 };
74 79
75 } // namespace blink 80 } // namespace blink
76 81
77 #endif // DecodingImageGenerator_h_ 82 #endif // DecodingImageGenerator_h_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698