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

Side by Side Diff: blimp/client/feature/compositor/client_image_serialization_processor.h

Issue 1985863002: Incorporate BlobChannel into Blimp image encode/decode pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-helium
Patch Set: nyquist feedback 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_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_H_ 5 #ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_H_
6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_H_ 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/singleton.h"
9 #include "cc/proto/image_serialization_processor.h" 12 #include "cc/proto/image_serialization_processor.h"
10 #include "third_party/skia/include/core/SkPicture.h" 13 #include "third_party/skia/include/core/SkPicture.h"
11 14
12 class SkPixelSerializer; 15 class SkPixelSerializer;
13 16
14 namespace blimp { 17 namespace blimp {
18
19 class BlobChannelReceiver;
20
15 namespace client { 21 namespace client {
16 22
17 // ClientImageSerializationProcessor provides functionality to deserialize Skia 23 // Adds BlobChannel image retrieval support to the Skia image decoding process.
18 // images.
19 class ClientImageSerializationProcessor 24 class ClientImageSerializationProcessor
20 : public cc::ImageSerializationProcessor { 25 : public cc::ImageSerializationProcessor {
21 public: 26 public:
27 class ErrorDelegate {
28 public:
29 virtual void OnImageDecodeError() = 0;
30 };
31
32 static ClientImageSerializationProcessor* GetInstance();
33
34 // Sets the |blob_receiver| to use for reading images.
35 // |blob_receiver| must outlive |this|.
36 void set_blob_receiver(BlobChannelReceiver* blob_receiver) {
37 blob_receiver_ = blob_receiver;
38 }
39
40 // |error_delegate| must outlive this.
41 void set_error_delegate(ErrorDelegate* error_delegate) {
42 error_delegate_ = error_delegate;
43 }
44
45 // Retrieves a bitmap with ID |input| from |blob_receiver_| and decodes it
46 // to |bitmap|.
47 bool GetAndDecodeBlob(const void* input, size_t input_size, SkBitmap* bitmap);
48
49 private:
50 friend struct base::DefaultSingletonTraits<ClientImageSerializationProcessor>;
51
22 ClientImageSerializationProcessor(); 52 ClientImageSerializationProcessor();
23 ~ClientImageSerializationProcessor(); 53 virtual ~ClientImageSerializationProcessor();
24 54
25 // cc::ImageSerializationProcessor implementation. 55 // Adapts a bare function pointer call to a singleton call to
56 // GetAndDecodeBlob().
57 static bool InstallPixelRefProc(const void* input,
58 size_t input_size,
59 SkBitmap* bitmap);
60
61 // cc:ImageSerializationProcessor implementation.
26 SkPixelSerializer* GetPixelSerializer() override; 62 SkPixelSerializer* GetPixelSerializer() override;
27 SkPicture::InstallPixelRefProc GetPixelDeserializer() override; 63 SkPicture::InstallPixelRefProc GetPixelDeserializer() override;
28 64
29 private: 65 // Interface for accessing stored images received over the Blob Channel.
30 SkPicture::InstallPixelRefProc pixel_deserializer_; 66 BlobChannelReceiver* blob_receiver_ = nullptr;
67
68 ErrorDelegate* error_delegate_ = nullptr;
31 69
32 DISALLOW_COPY_AND_ASSIGN(ClientImageSerializationProcessor); 70 DISALLOW_COPY_AND_ASSIGN(ClientImageSerializationProcessor);
33 }; 71 };
34 72
35 } // namespace client 73 } // namespace client
36 } // namespace blimp 74 } // namespace blimp
37 75
38 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_ H_ 76 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698