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