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

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

Issue 2918443003: Remove redundant reading and writing of data about SharedBuffer.
Patch Set: benchmark Created 3 years, 6 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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef DecodingImageGenerator_h 26 #ifndef DecodingImageGenerator_h
27 #define DecodingImageGenerator_h 27 #define DecodingImageGenerator_h
28 28
29 #include "platform/PlatformExport.h" 29 #include "platform/PlatformExport.h"
30 #include "platform/SharedBuffer.h"
30 #include "platform/image-decoders/SegmentReader.h" 31 #include "platform/image-decoders/SegmentReader.h"
31 #include "platform/wtf/Allocator.h" 32 #include "platform/wtf/Allocator.h"
32 #include "platform/wtf/Noncopyable.h" 33 #include "platform/wtf/Noncopyable.h"
33 #include "platform/wtf/PassRefPtr.h" 34 #include "platform/wtf/PassRefPtr.h"
34 #include "platform/wtf/RefPtr.h" 35 #include "platform/wtf/RefPtr.h"
35 #include "third_party/skia/include/core/SkImageGenerator.h" 36 #include "third_party/skia/include/core/SkImageGenerator.h"
36 #include "third_party/skia/include/core/SkImageInfo.h" 37 #include "third_party/skia/include/core/SkImageInfo.h"
37 38
38 class SkData; 39 class SkData;
39 40
(...skipping 13 matching lines...) Expand all
53 enum { kNeedNewImageUniqueID = SkImageGenerator::kNeedNewImageUniqueID }; 54 enum { kNeedNewImageUniqueID = SkImageGenerator::kNeedNewImageUniqueID };
54 55
55 static SkImageGenerator* Create(SkData*); 56 static SkImageGenerator* Create(SkData*);
56 57
57 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, 58 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>,
58 const SkImageInfo&, 59 const SkImageInfo&,
59 PassRefPtr<SegmentReader>, 60 PassRefPtr<SegmentReader>,
60 bool all_data_received, 61 bool all_data_received,
61 size_t index, 62 size_t index,
62 uint32_t unique_id = kNeedNewImageUniqueID); 63 uint32_t unique_id = kNeedNewImageUniqueID);
64
65 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>,
66 const SkImageInfo&,
67 PassRefPtr<SharedBuffer::ThreadSafeStepper>,
68 bool all_data_received,
69 size_t index,
70 uint32_t unique_id = kNeedNewImageUniqueID);
71
63 ~DecodingImageGenerator() override; 72 ~DecodingImageGenerator() override;
64 73
65 void SetCanYUVDecode(bool yes) { can_yuv_decode_ = yes; } 74 void SetCanYUVDecode(bool yes) { can_yuv_decode_ = yes; }
66 75
67 protected: 76 protected:
68 SkData* onRefEncodedData() override; 77 SkData* onRefEncodedData() override;
69 78
70 bool onGetPixels(const SkImageInfo&, 79 bool onGetPixels(const SkImageInfo&,
71 void* pixels, 80 void* pixels,
72 size_t row_bytes, 81 size_t row_bytes,
73 const Options&) override; 82 const Options&) override;
74 83
75 bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const override; 84 bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const override;
76 85
77 bool onGetYUV8Planes(const SkYUVSizeInfo&, void* planes[3]) override; 86 bool onGetYUV8Planes(const SkYUVSizeInfo&, void* planes[3]) override;
78 87
79 private: 88 private:
89 PassRefPtr<SegmentReader> encoded_data() const;
90
80 RefPtr<ImageFrameGenerator> frame_generator_; 91 RefPtr<ImageFrameGenerator> frame_generator_;
81 const RefPtr<SegmentReader> data_; // Data source. 92 const RefPtr<SegmentReader> reader_;
93 const RefPtr<SharedBuffer::ThreadSafeStepper> stepper_;
82 const bool all_data_received_; 94 const bool all_data_received_;
83 const size_t frame_index_; 95 const size_t frame_index_;
84 bool can_yuv_decode_; 96 bool can_yuv_decode_;
85 }; 97 };
86 98
87 } // namespace blink 99 } // namespace blink
88 100
89 #endif // DecodingImageGenerator_h_ 101 #endif // DecodingImageGenerator_h_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698