| 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_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ | 5 #ifndef BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ |
| 6 #define BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ | 6 #define BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "blimp/engine/mojo/blob_channel.mojom.h" | 10 #include "blimp/engine/mojo/blob_channel.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 | 12 |
| 11 namespace blimp { | 13 namespace blimp { |
| 12 | 14 |
| 13 class BlobChannelSender; | 15 class BlobChannelSender; |
| 14 | 16 |
| 15 namespace engine { | 17 namespace engine { |
| 16 | 18 |
| 17 // Service for processing BlobChannel requests from the renderer. | 19 // Service for processing BlobChannel requests from the renderer. |
| 18 // Runs on the browser process. | 20 // Runs on the browser process. |
| 19 class BlobChannelService : public mojom::BlobChannel { | 21 class BlobChannelService : public mojom::BlobChannel { |
| 20 public: | 22 public: |
| 21 ~BlobChannelService() override; | 23 ~BlobChannelService() override; |
| 22 | 24 |
| 23 // Factory method called by Mojo. | 25 // Factory method called by Mojo. |
| 24 static void Create(BlobChannelSender* blob_channel_sender, | 26 static void Create(BlobChannelSender* blob_channel_sender, |
| 25 mojo::InterfaceRequest<mojom::BlobChannel> request); | 27 mojo::InterfaceRequest<mojom::BlobChannel> request); |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 // Creates a BlobChannel bound to the connection specified by |request|. | 30 // Creates a BlobChannel bound to the connection specified by |request|. |
| 29 // |blob_channel_sender| must outlive the Mojo connection. | 31 // |blob_channel_sender| must outlive the Mojo connection. |
| 30 BlobChannelService(BlobChannelSender* blob_channel_sender, | 32 BlobChannelService(BlobChannelSender* blob_channel_sender, |
| 31 mojom::BlobChannelRequest request); | 33 mojom::BlobChannelRequest request); |
| 32 | 34 |
| 33 // BlobChannel implementation. | 35 // BlobChannel implementation. |
| 34 void PutBlob(const mojo::String& id, | 36 void GetCachedBlobIds( |
| 37 const GetCachedBlobIdsCallback& response_callback) override; |
| 38 void PutBlob(const std::string& id, |
| 35 mojo::ScopedSharedBufferHandle data, | 39 mojo::ScopedSharedBufferHandle data, |
| 36 uint32_t size) override; | 40 uint32_t size) override; |
| 37 void DeliverBlob(const mojo::String& id) override; | 41 void DeliverBlob(const std::string& id) override; |
| 38 | 42 |
| 39 // Binds |this| and its object lifetime to a Mojo connection. | 43 // Binds |this| and its object lifetime to a Mojo connection. |
| 40 mojo::StrongBinding<mojom::BlobChannel> binding_; | 44 mojo::StrongBinding<mojom::BlobChannel> binding_; |
| 41 | 45 |
| 42 // Sender object which will receive the blobs passed over the Mojo service. | 46 // Sender object which will receive the blobs passed over the Mojo service. |
| 43 BlobChannelSender* blob_channel_sender_; | 47 BlobChannelSender* blob_channel_sender_; |
| 44 | 48 |
| 45 DISALLOW_COPY_AND_ASSIGN(BlobChannelService); | 49 DISALLOW_COPY_AND_ASSIGN(BlobChannelService); |
| 46 }; | 50 }; |
| 47 | 51 |
| 48 } // namespace engine | 52 } // namespace engine |
| 49 } // namespace blimp | 53 } // namespace blimp |
| 50 | 54 |
| 51 #endif // BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ | 55 #endif // BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ |
| OLD | NEW |