Index: blimp/client/session/blimp_client_session.cc |
diff --git a/blimp/client/session/blimp_client_session.cc b/blimp/client/session/blimp_client_session.cc |
index 4fc9834f29bc3e5aedc7ffa8fd5983adde1e4989..b85943b980f9842fbcc2be2524a28d6ddab0580f 100644 |
--- a/blimp/client/session/blimp_client_session.cc |
+++ b/blimp/client/session/blimp_client_session.cc |
@@ -18,9 +18,12 @@ |
#include "blimp/client/feature/render_widget_feature.h" |
#include "blimp/client/feature/settings_feature.h" |
#include "blimp/client/feature/tab_control_feature.h" |
+#include "blimp/common/blob_cache/in_memory_blob_cache.h" |
#include "blimp/net/blimp_connection.h" |
#include "blimp/net/blimp_message_processor.h" |
#include "blimp/net/blimp_message_thread_pipe.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" |
#include "blimp/net/client_connection_manager.h" |
#include "blimp/net/common.h" |
@@ -86,6 +89,8 @@ class ClientNetworkComponents : public ConnectionHandler, |
BrowserConnectionHandler* GetBrowserConnectionHandler(); |
+ void DropCurrentConnection(); |
+ |
private: |
// ConnectionHandler implementation. |
void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; |
@@ -152,6 +157,10 @@ ClientNetworkComponents::GetBrowserConnectionHandler() { |
return connection_handler_.get(); |
} |
+void ClientNetworkComponents::DropCurrentConnection() { |
+ connection_handler_->DropCurrentConnection(); |
+} |
+ |
void ClientNetworkComponents::HandleConnection( |
std::unique_ptr<BlimpConnection> connection) { |
VLOG(1) << "Connection established."; |
@@ -189,8 +198,18 @@ BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint) |
assignment_source_.reset(new AssignmentSource( |
assigner_endpoint, io_thread_.task_runner(), io_thread_.task_runner())); |
+ std::unique_ptr<HeliumBlobReceiverDelegate> blob_delegate( |
+ new HeliumBlobReceiverDelegate); |
+ blob_delegate_ = blob_delegate.get(); |
+ blob_receiver_ = BlobChannelReceiver::Create( |
+ base::WrapUnique(new InMemoryBlobCache), std::move(blob_delegate)); |
+ |
RegisterFeatures(); |
+ ClientImageSerializationProcessor::GetInstance()->set_blob_receiver( |
+ blob_receiver_.get()); |
+ ClientImageSerializationProcessor::GetInstance()->set_error_delegate(this); |
+ |
// Initialize must only be posted after the RegisterFeature calls have |
// completed. |
io_thread_.task_runner()->PostTask( |
@@ -251,6 +270,8 @@ void BlimpClientSession::RegisterFeatures() { |
settings_feature_->set_outgoing_message_processor( |
thread_pipe_manager_->RegisterFeature(BlimpMessage::kSettings, |
settings_feature_.get())); |
+ thread_pipe_manager_->RegisterFeature(BlimpMessage::kBlobChannel, |
+ blob_delegate_); |
// Client will not send send any RenderWidget messages, so don't save the |
// outgoing BlimpMessageProcessor in the RenderWidgetFeature. |
@@ -270,6 +291,12 @@ void BlimpClientSession::OnConnected() {} |
void BlimpClientSession::OnDisconnected(int result) {} |
+void BlimpClientSession::OnImageDecodeError() { |
+ io_thread_.task_runner()->PostTask( |
+ FROM_HERE, base::Bind(&ClientNetworkComponents::DropCurrentConnection, |
+ base::Unretained(net_components_.get()))); |
Wez
2016/06/07 01:18:31
DropCurrentConnection() is expected to be called a
Kevin M
2016/06/08 00:21:09
I made BrowserConnectionHandler::DropCurrentConnec
Wez
2016/06/10 22:29:54
Acknowledged.
|
+} |
+ |
TabControlFeature* BlimpClientSession::GetTabControlFeature() const { |
return tab_control_feature_.get(); |
} |