Index: blimp/client/feature/compositor/client_image_serialization_processor.h |
diff --git a/blimp/client/feature/compositor/client_image_serialization_processor.h b/blimp/client/feature/compositor/client_image_serialization_processor.h |
index 5118f428cf6b539e65cf1bc2dc03743a78c35f39..c0a8a7b2299a8153fb982bcecb46bfd8af3441ff 100644 |
--- a/blimp/client/feature/compositor/client_image_serialization_processor.h |
+++ b/blimp/client/feature/compositor/client_image_serialization_processor.h |
@@ -5,29 +5,52 @@ |
#ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_H_ |
#define BLIMP_CLIENT_FEATURE_COMPOSITOR_CLIENT_IMAGE_SERIALIZATION_PROCESSOR_H_ |
+#include <memory> |
+ |
#include "base/macros.h" |
+#include "base/memory/singleton.h" |
#include "cc/proto/image_serialization_processor.h" |
#include "third_party/skia/include/core/SkPicture.h" |
class SkPixelSerializer; |
namespace blimp { |
+ |
+class BlobChannelReceiver; |
+ |
namespace client { |
-// ClientImageSerializationProcessor provides functionality to deserialize Skia |
-// images. |
+// Adds BlobChannel image retrieval support to the Skia image decoding process. |
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.
|
: public cc::ImageSerializationProcessor { |
public: |
+ 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.
|
+ |
+ 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.
|
+ |
+ 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.
|
+ blob_receiver_ = blob_receiver; |
+ } |
+ |
+ // Retrieves a bitmap with ID |input| from |blob_receiver_| and decodes it |
+ // to |bitmap|. |
+ bool GetAndDecodeBlob(const void* input, size_t input_size, SkBitmap* bitmap); |
+ |
+ private: |
ClientImageSerializationProcessor(); |
Wez
2016/05/21 01:08:03
nit: Move this below the friend.
Kevin M
2016/05/27 22:35:29
Done.
|
- ~ClientImageSerializationProcessor(); |
+ friend struct base::DefaultSingletonTraits<ClientImageSerializationProcessor>; |
- // cc::ImageSerializationProcessor implementation. |
+ // Adapts a bare function pointer call to a singleton call to |
+ // GetAndDecodeBlob(). |
+ static bool InstallPixelRefProc(const void* input, |
+ size_t input_size, |
+ SkBitmap* bitmap); |
+ |
+ // cc:ImageSerializationProcessor implementation. |
SkPixelSerializer* GetPixelSerializer() override; |
SkPicture::InstallPixelRefProc GetPixelDeserializer() override; |
- private: |
- SkPicture::InstallPixelRefProc pixel_deserializer_; |
+ 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.
|
DISALLOW_COPY_AND_ASSIGN(ClientImageSerializationProcessor); |
}; |