Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
|
Wez
2016/05/21 01:08:03
nit: Should this be BlobImageSerializationProcesso
Kevin M
2016/05/27 22:35:29
I know they're in different namespaces, but it see
Wez
2016/06/07 01:18:31
My point is that names ssociating them w/ Client &
Kevin M
2016/06/08 00:21:09
Done.
| |
| 20 : public cc::ImageSerializationProcessor { | 25 : public cc::ImageSerializationProcessor { |
| 21 public: | 26 public: |
| 27 virtual ~ClientImageSerializationProcessor(); | |
|
Wez
2016/05/21 01:08:03
Why is the destructor public if this is a singleto
Kevin M
2016/05/27 22:35:29
Done.
| |
| 28 | |
| 29 static ClientImageSerializationProcessor* GetInstance(); | |
|
Wez
2016/05/21 01:08:03
Do we actually need this to be a singleton? Is it
Kevin M
2016/05/27 22:35:29
The Skia decode callback is a raw function pointer
Wez
2016/06/07 01:18:31
Right; I get that we need a function to get-the-cu
Kevin M
2016/06/08 00:21:09
Interesting, done.
| |
| 30 | |
| 31 void set_blob_receiver(BlobChannelReceiver* blob_receiver) { | |
|
Wez
2016/05/21 01:08:03
nit: Clarify ownership/lifetime expectations of bl
Kevin M
2016/05/27 22:35:29
Done.
| |
| 32 blob_receiver_ = blob_receiver; | |
| 33 } | |
| 34 | |
| 35 // Retrieves a bitmap with ID |input| from |blob_receiver_| and decodes it | |
| 36 // to |bitmap|. | |
| 37 bool GetAndDecodeBlob(const void* input, size_t input_size, SkBitmap* bitmap); | |
| 38 | |
| 39 private: | |
| 22 ClientImageSerializationProcessor(); | 40 ClientImageSerializationProcessor(); |
|
Wez
2016/05/21 01:08:03
nit: Move this below the friend.
Kevin M
2016/05/27 22:35:29
Done.
| |
| 23 ~ClientImageSerializationProcessor(); | 41 friend struct base::DefaultSingletonTraits<ClientImageSerializationProcessor>; |
| 24 | 42 |
| 25 // cc::ImageSerializationProcessor implementation. | 43 // Adapts a bare function pointer call to a singleton call to |
| 44 // GetAndDecodeBlob(). | |
| 45 static bool InstallPixelRefProc(const void* input, | |
| 46 size_t input_size, | |
| 47 SkBitmap* bitmap); | |
| 48 | |
| 49 // cc:ImageSerializationProcessor implementation. | |
| 26 SkPixelSerializer* GetPixelSerializer() override; | 50 SkPixelSerializer* GetPixelSerializer() override; |
| 27 SkPicture::InstallPixelRefProc GetPixelDeserializer() override; | 51 SkPicture::InstallPixelRefProc GetPixelDeserializer() override; |
| 28 | 52 |
| 29 private: | 53 BlobChannelReceiver* blob_receiver_ = nullptr; |
|
Wez
2016/05/21 01:08:03
nit: Comment to explain this member - how is it us
Kevin M
2016/05/27 22:35:29
Done.
| |
| 30 SkPicture::InstallPixelRefProc pixel_deserializer_; | |
| 31 | 54 |
| 32 DISALLOW_COPY_AND_ASSIGN(ClientImageSerializationProcessor); | 55 DISALLOW_COPY_AND_ASSIGN(ClientImageSerializationProcessor); |
| 33 }; | 56 }; |
| 34 | 57 |
| 35 } // namespace client | 58 } // namespace client |
| 36 } // namespace blimp | 59 } // namespace blimp |
| 37 | 60 |
| 38 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_ H_ | 61 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_ H_ |
| OLD | NEW |