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_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 "blimp/engine/mojo/blob_channel.mojom.h" | 8 #include "blimp/engine/mojo/blob_channel.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" | 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 | 10 |
| 11 namespace blimp { | 11 namespace blimp { |
| 12 | |
| 13 class BlobChannelSender; | |
| 14 | |
| 12 namespace engine { | 15 namespace engine { |
| 13 | 16 |
| 14 // Service for processing BlobChannel requests from the renderer. | 17 // Service for processing BlobChannel requests from the renderer. |
| 15 // Runs on the browser process. | 18 // Runs on the browser process. |
| 16 class BlobChannelService : public mojom::BlobChannel { | 19 class BlobChannelService : public mojom::BlobChannel { |
| 17 public: | 20 public: |
| 18 // Creates a BlobChannel bound to the connection specified by |request|. | 21 // Creates a BlobChannel bound to the connection specified by |request|. |
| 19 explicit BlobChannelService(mojom::BlobChannelRequest request); | 22 // |blob_channel| must outlive the Mojo connection. |
| 23 explicit BlobChannelService(BlobChannelSender* blob_channel, | |
|
Wez
2016/05/21 01:08:04
nit: Drop "explicit" here.
Kevin M
2016/05/27 22:35:30
Done.
| |
| 24 mojom::BlobChannelRequest request); | |
| 20 ~BlobChannelService() override; | 25 ~BlobChannelService() override; |
| 21 | 26 |
| 22 // Factory method called by Mojo. | 27 // Factory method called by Mojo. |
|
Wez
2016/05/21 01:08:04
Why do we need both the factory method and the con
Kevin M
2016/05/27 22:35:30
Good question! Done.
| |
| 23 static void Create(mojo::InterfaceRequest<mojom::BlobChannel> request); | 28 static void Create(BlobChannelSender* blob_channel, |
| 29 mojo::InterfaceRequest<mojom::BlobChannel> request); | |
| 24 | 30 |
| 25 private: | 31 private: |
| 26 // BlobChannel implementation. | 32 // BlobChannel implementation. |
| 27 void Put(const mojo::String& id, mojo::Array<uint8_t> data) override; | 33 void Put(const mojo::String& id, const mojo::String& data) override; |
| 28 void Push(const mojo::String& id) override; | 34 void Push(const mojo::String& id) override; |
| 29 | 35 |
| 30 // Binds |this| and its object lifetime to a Mojo connection. | 36 // Binds |this| and its object lifetime to a Mojo connection. |
| 31 mojo::StrongBinding<mojom::BlobChannel> binding_; | 37 mojo::StrongBinding<mojom::BlobChannel> binding_; |
| 32 | 38 |
| 39 BlobChannelSender* blob_channel_; | |
|
Wez
2016/05/21 01:08:04
nit: Add one-line comment to explain what this is
Kevin M
2016/05/27 22:35:30
Done.
| |
| 40 | |
| 33 DISALLOW_COPY_AND_ASSIGN(BlobChannelService); | 41 DISALLOW_COPY_AND_ASSIGN(BlobChannelService); |
| 34 }; | 42 }; |
| 35 | 43 |
| 36 } // namespace engine | 44 } // namespace engine |
| 37 } // namespace blimp | 45 } // namespace blimp |
| 38 | 46 |
| 39 #endif // BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ | 47 #endif // BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_ |
| OLD | NEW |