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