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

Side by Side Diff: blimp/engine/renderer/engine_image_serialization_processor.h

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from vmpstr, including adding //cc/blimp Created 4 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_ 5 #ifndef BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_
6 #define BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_ 6 #define BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "blimp/common/blimp_common_export.h" 12 #include "blimp/common/blimp_common_export.h"
13 #include "blimp/common/blob_cache/id_util.h" 13 #include "blimp/common/blob_cache/id_util.h"
14 #include "blimp/engine/mojo/blob_channel.mojom.h" 14 #include "blimp/engine/mojo/blob_channel.mojom.h"
15 #include "cc/proto/image_serialization_processor.h" 15 #include "cc/blimp/client_picture_cache.h"
16 #include "cc/blimp/engine_picture_cache.h"
17 #include "cc/blimp/image_serialization_processor.h"
16 #include "third_party/libwebp/webp/encode.h" 18 #include "third_party/libwebp/webp/encode.h"
17 #include "third_party/skia/include/core/SkPicture.h"
18 #include "third_party/skia/include/core/SkPixelSerializer.h" 19 #include "third_party/skia/include/core/SkPixelSerializer.h"
19 20
20 namespace content { 21 namespace content {
21 class RenderFrame; 22 class RenderFrame;
22 } // class content 23 } // class content
23 24
24 namespace blimp { 25 namespace blimp {
25 namespace engine { 26 namespace engine {
26 27
27 class BlobChannelSenderProxy; 28 class BlobChannelSenderProxy;
28 29
29 // EngineImageSerializationProcessor provides functionality to serialize and 30 // EngineImageSerializationProcessor provides functionality to serialize
30 // deserialize Skia images. 31 // and temporarily cache Skia images.
31 class BLIMP_COMMON_EXPORT EngineImageSerializationProcessor 32 class BLIMP_COMMON_EXPORT EngineImageSerializationProcessor
32 : public cc::ImageSerializationProcessor, 33 : public cc::ImageSerializationProcessor,
33 public SkPixelSerializer { 34 public SkPixelSerializer {
34 public: 35 public:
35 explicit EngineImageSerializationProcessor( 36 explicit EngineImageSerializationProcessor(
36 std::unique_ptr<BlobChannelSenderProxy> blob_channel); 37 std::unique_ptr<BlobChannelSenderProxy> blob_channel);
37 ~EngineImageSerializationProcessor() override; 38 ~EngineImageSerializationProcessor() override;
38 39
39 // cc::ImageSerializationProcessor implementation. 40 // cc::ImageSerializationProcessor implementation.
40 SkPixelSerializer* GetPixelSerializer() override; 41 std::unique_ptr<cc::EnginePictureCache> CreateEnginePictureCache() override;
41 SkPicture::InstallPixelRefProc GetPixelDeserializer() override; 42 std::unique_ptr<cc::ClientPictureCache> CreateClientPictureCache() override;
42 43
43 // SkPixelSerializer implementation. 44 // SkPixelSerializer implementation.
44 bool onUseEncodedData(const void* data, size_t len) override; 45 bool onUseEncodedData(const void* data, size_t len) override;
45 SkData* onEncode(const SkPixmap& pixmap) override; 46 SkData* onEncode(const SkPixmap& pixmap) override;
46 47
47 private: 48 private:
48 scoped_refptr<BlobData> EncodeImageAsBlob(const SkPixmap& pixmap); 49 scoped_refptr<BlobData> EncodeImageAsBlob(const SkPixmap& pixmap);
49 50
51 // A serializer that be used to pass in to SkPicture::serialize(...) for
52 // serializing the SkPicture to a stream.
50 std::unique_ptr<SkPixelSerializer> pixel_serializer_; 53 std::unique_ptr<SkPixelSerializer> pixel_serializer_;
51 54
52 // Sends image data as blobs to the browser process. 55 // Sends image data as blobs to the browser process.
53 std::unique_ptr<BlobChannelSenderProxy> blob_channel_; 56 std::unique_ptr<BlobChannelSenderProxy> blob_channel_;
54 57
55 // Reusable output buffer for image encoding. 58 // Reusable output buffer for image encoding.
56 WebPMemoryWriter writer_state_; 59 WebPMemoryWriter writer_state_;
57 60
58 DISALLOW_COPY_AND_ASSIGN(EngineImageSerializationProcessor); 61 DISALLOW_COPY_AND_ASSIGN(EngineImageSerializationProcessor);
59 }; 62 };
60 63
61 } // namespace engine 64 } // namespace engine
62 } // namespace blimp 65 } // namespace blimp
63 66
64 #endif // BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_ 67 #endif // BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698