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 #include "blimp/engine/mojo/blob_channel_service.h" | 5 #include "blimp/engine/mojo/blob_channel_service.h" |
| 6 | 6 |
| 7 #include <vector> | |
| 8 | |
| 9 #include "blimp/net/blob_channel/blob_channel_sender.h" | |
| 10 | |
| 7 namespace blimp { | 11 namespace blimp { |
| 8 namespace engine { | 12 namespace engine { |
| 9 | 13 |
| 10 BlobChannelService::BlobChannelService(mojom::BlobChannelRequest request) | 14 BlobChannelService::BlobChannelService(BlobChannelSender* blob_channel, |
| 11 : binding_(this, std::move(request)) {} | 15 mojom::BlobChannelRequest request) |
| 16 : binding_(this, std::move(request)), blob_channel_(blob_channel) { | |
| 17 DCHECK(blob_channel_); | |
| 18 } | |
| 12 | 19 |
| 13 BlobChannelService::~BlobChannelService() {} | 20 BlobChannelService::~BlobChannelService() {} |
| 14 | 21 |
| 15 void BlobChannelService::Put(const mojo::String& id, | 22 void BlobChannelService::Put(const mojo::String& id, const mojo::String& data) { |
| 16 mojo::Array<uint8_t> data) { | 23 blob_channel_->PutBlob(id, new BlobData(data)); |
| 17 NOTIMPLEMENTED(); | |
| 18 } | 24 } |
| 19 | 25 |
| 20 void BlobChannelService::Push(const mojo::String& id) { | 26 void BlobChannelService::Push(const mojo::String& id) { |
| 21 NOTIMPLEMENTED(); | 27 blob_channel_->DeliverBlob(id); |
|
Wez
2016/05/21 01:08:04
nit: Why do the BlobChannelSender and Service have
Kevin M
2016/05/27 22:35:30
Done.
| |
| 22 } | 28 } |
| 23 | 29 |
| 24 // static | 30 // static |
| 25 void BlobChannelService::Create( | 31 void BlobChannelService::Create( |
| 32 BlobChannelSender* blob_channel, | |
| 26 mojo::InterfaceRequest<mojom::BlobChannel> request) { | 33 mojo::InterfaceRequest<mojom::BlobChannel> request) { |
| 27 // Object lifetime is managed by BlobChannelService's StrongBinding | 34 // Object lifetime is managed by BlobChannelService's StrongBinding |
| 28 // |binding_|. | 35 // |binding_|. |
| 29 new BlobChannelService(std::move(request)); | 36 new BlobChannelService(blob_channel, std::move(request)); |
| 30 } | 37 } |
| 31 | 38 |
| 32 } // namespace engine | 39 } // namespace engine |
| 33 } // namespace blimp | 40 } // namespace blimp |
| OLD | NEW |