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

Unified Diff: blimp/net/browser_connection_handler.cc

Issue 1551583003: Implementation and fixes for Blimp client/engine E2E communication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dtrainor-linux-cl1528243002
Patch Set: Fixed misplaced EXPORT directive Created 4 years, 12 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
« no previous file with comments | « blimp/net/blimp_message_pump.cc ('k') | blimp/net/browser_connection_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/browser_connection_handler.cc
diff --git a/blimp/net/browser_connection_handler.cc b/blimp/net/browser_connection_handler.cc
index 896803c68323180cf413aca9219955b3eed2eded..78009cc3343e81d4d7a9d3477f98e2cef65daefb 100644
--- a/blimp/net/browser_connection_handler.cc
+++ b/blimp/net/browser_connection_handler.cc
@@ -42,31 +42,29 @@ scoped_ptr<BlimpMessageProcessor> BrowserConnectionHandler::RegisterFeature(
void BrowserConnectionHandler::HandleConnection(
scoped_ptr<BlimpConnection> connection) {
- // Since there is only a single Client, assume a newer connection should
- // replace an existing one.
- DropCurrentConnection();
+ DCHECK(connection);
+ VLOG(1) << "HandleConnection " << connection;
+
+ if (connection_) {
+ DropCurrentConnection();
+ }
connection_ = std::move(connection);
- connection_->SetConnectionErrorObserver(this);
- // Connect the incoming & outgoing message streams.
- connection_->SetIncomingMessageProcessor(checkpointer_.get());
+ // Hook up message streams to the connection.
+ connection_->SetIncomingMessageProcessor(demultiplexer_.get());
output_buffer_->SetOutputProcessor(
connection_->GetOutgoingMessageProcessor());
+ connection_->AddConnectionErrorObserver(this);
}
-void BrowserConnectionHandler::DropCurrentConnection() {
- if (!connection_)
- return;
+void BrowserConnectionHandler::OnConnectionError(int error) {
+ DropCurrentConnection();
+}
- connection_->SetConnectionErrorObserver(nullptr);
- connection_->SetIncomingMessageProcessor(nullptr);
+void BrowserConnectionHandler::DropCurrentConnection() {
+ DCHECK(connection_);
output_buffer_->SetOutputProcessor(nullptr);
connection_.reset();
}
-void BrowserConnectionHandler::OnConnectionError(int error) {
- LOG(WARNING) << "Connection error " << net::ErrorToString(error);
- DropCurrentConnection();
-}
-
} // namespace blimp
« no previous file with comments | « blimp/net/blimp_message_pump.cc ('k') | blimp/net/browser_connection_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698