Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1178)

Unified Diff: blimp/client/core/compositor/blob_manager.cc

Issue 2300493002: Move glue code of blob channel to blimp_client_context_impl. (Closed)
Patch Set: More polish on comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/compositor/blob_manager.cc
diff --git a/blimp/client/core/compositor/blob_manager.cc b/blimp/client/core/compositor/blob_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dc53a53e31f11d4f89c24d2db2b3f7b1fe93a9ab
--- /dev/null
+++ b/blimp/client/core/compositor/blob_manager.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/client/core/compositor/blob_manager.h"
+#include "blimp/common/blob_cache/in_memory_blob_cache.h"
+#include "blimp/net/blob_channel/blob_channel_receiver.h"
+#include "blimp/net/blob_channel/helium_blob_receiver_delegate.h"
+#include "blimp/net/browser_connection_handler.h"
+
+namespace blimp {
+namespace client {
+
+BlobManager::BlobManager(
+ BlobImageSerializationProcessor::ErrorDelegate* delegate) {
+ std::unique_ptr<HeliumBlobReceiverDelegate> blob_delegate =
+ base::MakeUnique<HeliumBlobReceiverDelegate>();
+
+ // Set incoming blob message processor.
+ incoming_msg_processor_ = blob_delegate.get();
+
+ // Set BlobChannelReceiver that does the actual blob processing.
+ blob_receiver_ = BlobChannelReceiver::Create(
+ base::WrapUnique(new InMemoryBlobCache), std::move(blob_delegate));
+ blob_image_processor_.set_blob_receiver(blob_receiver_.get());
+
+ // Set image decode error delegate.
+ DCHECK(delegate);
+ blob_image_processor_.set_error_delegate(delegate);
+}
+
+BlobManager::~BlobManager() {}
+
+void BlobManager::ProcessMessage(std::unique_ptr<BlimpMessage> message,
+ const net::CompletionCallback& callback) {
+ DCHECK(incoming_msg_processor_);
+
+ // Forward the message to |incoming_msg_processor_|.
+ incoming_msg_processor_->ProcessMessage(std::move(message), callback);
+}
+
+} // namespace client
+} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698