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

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

Issue 2807073002: Removed local RefPtr objects created from PassRefPtr arguments. (Closed)
Patch Set: addressed review Created 3 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 /* 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 42
43 class ImageFrameGenerator; 43 class ImageFrameGenerator;
44 class SharedBuffer; 44 class SharedBuffer;
45 struct DeferredFrameData; 45 struct DeferredFrameData;
46 46
47 class PLATFORM_EXPORT DeferredImageDecoder final { 47 class PLATFORM_EXPORT DeferredImageDecoder final {
48 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); 48 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder);
49 USING_FAST_MALLOC(DeferredImageDecoder); 49 USING_FAST_MALLOC(DeferredImageDecoder);
50 50
51 public: 51 public:
52 static std::unique_ptr<DeferredImageDecoder> Create( 52 static std::unique_ptr<DeferredImageDecoder> Create(RefPtr<SharedBuffer> data,
53 PassRefPtr<SharedBuffer> data, 53 bool data_complete,
54 bool data_complete, 54 ImageDecoder::AlphaOption,
55 ImageDecoder::AlphaOption, 55 const ColorBehavior&);
56 const ColorBehavior&);
57 56
58 static std::unique_ptr<DeferredImageDecoder> CreateForTesting( 57 static std::unique_ptr<DeferredImageDecoder> CreateForTesting(
59 std::unique_ptr<ImageDecoder>); 58 std::unique_ptr<ImageDecoder>);
60 59
61 ~DeferredImageDecoder(); 60 ~DeferredImageDecoder();
62 61
63 String FilenameExtension() const; 62 String FilenameExtension() const;
64 63
65 sk_sp<SkImage> CreateFrameAtIndex(size_t); 64 sk_sp<SkImage> CreateFrameAtIndex(size_t);
66 65
(...skipping 18 matching lines...) Expand all
85 explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actual_decoder); 84 explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actual_decoder);
86 85
87 friend class DeferredImageDecoderTest; 86 friend class DeferredImageDecoderTest;
88 ImageFrameGenerator* FrameGenerator() { return frame_generator_.Get(); } 87 ImageFrameGenerator* FrameGenerator() { return frame_generator_.Get(); }
89 88
90 void ActivateLazyDecoding(); 89 void ActivateLazyDecoding();
91 void PrepareLazyDecodedFrames(); 90 void PrepareLazyDecodedFrames();
92 91
93 sk_sp<SkImage> CreateFrameImageAtIndex(size_t index, bool known_to_be_opaque); 92 sk_sp<SkImage> CreateFrameImageAtIndex(size_t index, bool known_to_be_opaque);
94 93
95 void SetDataInternal(PassRefPtr<SharedBuffer> data, 94 void SetDataInternal(RefPtr<SharedBuffer> data,
96 bool all_data_received, 95 bool all_data_received,
97 bool push_data_to_decoder); 96 bool push_data_to_decoder);
98 97
99 // Copy of the data that is passed in, used by deferred decoding. 98 // Copy of the data that is passed in, used by deferred decoding.
100 // Allows creating readonly snapshots that may be read in another thread. 99 // Allows creating readonly snapshots that may be read in another thread.
101 std::unique_ptr<SkRWBuffer> rw_buffer_; 100 std::unique_ptr<SkRWBuffer> rw_buffer_;
102 bool all_data_received_; 101 bool all_data_received_;
103 std::unique_ptr<ImageDecoder> actual_decoder_; 102 std::unique_ptr<ImageDecoder> actual_decoder_;
104 103
105 String filename_extension_; 104 String filename_extension_;
106 IntSize size_; 105 IntSize size_;
107 int repetition_count_; 106 int repetition_count_;
108 bool has_embedded_color_space_ = false; 107 bool has_embedded_color_space_ = false;
109 sk_sp<SkColorSpace> color_space_for_sk_images_; 108 sk_sp<SkColorSpace> color_space_for_sk_images_;
110 bool can_yuv_decode_; 109 bool can_yuv_decode_;
111 bool has_hot_spot_; 110 bool has_hot_spot_;
112 IntPoint hot_spot_; 111 IntPoint hot_spot_;
113 112
114 // Caches frame state information. 113 // Caches frame state information.
115 Vector<DeferredFrameData> frame_data_; 114 Vector<DeferredFrameData> frame_data_;
116 RefPtr<ImageFrameGenerator> frame_generator_; 115 RefPtr<ImageFrameGenerator> frame_generator_;
117 }; 116 };
118 117
119 } // namespace blink 118 } // namespace blink
120 119
121 #endif 120 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698