OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "blimp/client/core/compositor/blob_channel_feature.h" | |
6 | |
7 #include "base/memory/ptr_util.h" | |
8 #include "blimp/common/blob_cache/in_memory_blob_cache.h" | |
9 #include "blimp/common/proto/blimp_message.pb.h" | |
10 #include "blimp/net/blob_channel/blob_channel_receiver.h" | |
11 #include "blimp/net/blob_channel/helium_blob_receiver_delegate.h" | |
12 | |
13 namespace blimp { | |
14 namespace client { | |
15 | |
16 BlobChannelFeature::BlobChannelFeature( | |
17 BlobImageSerializationProcessor::ErrorDelegate* delegate) { | |
18 std::unique_ptr<HeliumBlobReceiverDelegate> blob_delegate = | |
19 base::MakeUnique<HeliumBlobReceiverDelegate>(); | |
20 | |
21 // Set incoming blob message processor. | |
22 incoming_msg_processor_ = blob_delegate.get(); | |
23 | |
24 // Set BlobChannelReceiver that does the actual blob processing. | |
25 blob_receiver_ = BlobChannelReceiver::Create( | |
26 base::MakeUnique<InMemoryBlobCache>(), std::move(blob_delegate)); | |
27 blob_image_processor_.set_blob_receiver(blob_receiver_.get()); | |
28 | |
29 // Set image decode error delegate. | |
30 DCHECK(delegate); | |
31 blob_image_processor_.set_error_delegate(delegate); | |
32 } | |
33 | |
34 BlobChannelFeature::~BlobChannelFeature() = default; | |
35 | |
36 void BlobChannelFeature::ProcessMessage( | |
37 std::unique_ptr<BlimpMessage> message, | |
38 const net::CompletionCallback& callback) { | |
39 DCHECK(incoming_msg_processor_); | |
40 | |
41 // Forward the message to |incoming_msg_processor_|. | |
42 incoming_msg_processor_->ProcessMessage(std::move(message), callback); | |
43 } | |
44 | |
45 } // namespace client | |
46 } // namespace blimp | |
OLD | NEW |