OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "blimp/net/browser_connection_handler.h" | 5 #include "blimp/net/browser_connection_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "blimp/net/blimp_connection.h" | 9 #include "blimp/net/blimp_connection.h" |
10 #include "blimp/net/blimp_message_checkpointer.h" | 10 #include "blimp/net/blimp_message_checkpointer.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 output_buffer_(new BlimpMessageOutputBuffer(kMaxBufferSizeBytes)), | 28 output_buffer_(new BlimpMessageOutputBuffer(kMaxBufferSizeBytes)), |
29 multiplexer_(new BlimpMessageMultiplexer(output_buffer_.get())), | 29 multiplexer_(new BlimpMessageMultiplexer(output_buffer_.get())), |
30 checkpointer_(new BlimpMessageCheckpointer(demultiplexer_.get(), | 30 checkpointer_(new BlimpMessageCheckpointer(demultiplexer_.get(), |
31 output_buffer_.get(), | 31 output_buffer_.get(), |
32 output_buffer_.get())) {} | 32 output_buffer_.get())) {} |
33 | 33 |
34 BrowserConnectionHandler::~BrowserConnectionHandler() {} | 34 BrowserConnectionHandler::~BrowserConnectionHandler() {} |
35 | 35 |
36 std::unique_ptr<BlimpMessageProcessor> | 36 std::unique_ptr<BlimpMessageProcessor> |
37 BrowserConnectionHandler::RegisterFeature( | 37 BrowserConnectionHandler::RegisterFeature( |
38 BlimpMessage::Type type, | 38 BlimpMessage::FeatureCase feature_case, |
39 BlimpMessageProcessor* incoming_processor) { | 39 BlimpMessageProcessor* incoming_processor) { |
40 demultiplexer_->AddProcessor(type, incoming_processor); | 40 demultiplexer_->AddProcessor(feature_case, incoming_processor); |
41 return multiplexer_->CreateSenderForType(type); | 41 return multiplexer_->CreateSender(feature_case); |
42 } | 42 } |
43 | 43 |
44 void BrowserConnectionHandler::HandleConnection( | 44 void BrowserConnectionHandler::HandleConnection( |
45 std::unique_ptr<BlimpConnection> connection) { | 45 std::unique_ptr<BlimpConnection> connection) { |
46 DCHECK(connection); | 46 DCHECK(connection); |
47 VLOG(1) << "HandleConnection " << connection.get(); | 47 VLOG(1) << "HandleConnection " << connection.get(); |
48 | 48 |
49 if (connection_) { | 49 if (connection_) { |
50 DropCurrentConnection(); | 50 DropCurrentConnection(); |
51 } | 51 } |
(...skipping 10 matching lines...) Expand all Loading... |
62 DropCurrentConnection(); | 62 DropCurrentConnection(); |
63 } | 63 } |
64 | 64 |
65 void BrowserConnectionHandler::DropCurrentConnection() { | 65 void BrowserConnectionHandler::DropCurrentConnection() { |
66 DCHECK(connection_); | 66 DCHECK(connection_); |
67 output_buffer_->SetOutputProcessor(nullptr); | 67 output_buffer_->SetOutputProcessor(nullptr); |
68 connection_.reset(); | 68 connection_.reset(); |
69 } | 69 } |
70 | 70 |
71 } // namespace blimp | 71 } // namespace blimp |
OLD | NEW |