| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/protocol/channel_dispatcher_base.h" | 5 #include "remoting/protocol/channel_dispatcher_base.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "remoting/base/compound_buffer.h" | 10 #include "remoting/base/compound_buffer.h" |
| 11 #include "remoting/protocol/message_channel_factory.h" | 11 #include "remoting/protocol/message_channel_factory.h" |
| 12 #include "remoting/protocol/message_pipe.h" | 12 #include "remoting/protocol/message_pipe.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 namespace protocol { | 15 namespace protocol { |
| 16 | 16 |
| 17 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name) | 17 ChannelDispatcherBase::ChannelDispatcherBase(const std::string& channel_name) |
| 18 : channel_name_(channel_name) {} | 18 : channel_name_(channel_name) {} |
| 19 | 19 |
| 20 ChannelDispatcherBase::~ChannelDispatcherBase() { | 20 ChannelDispatcherBase::~ChannelDispatcherBase() { |
| 21 if (channel_factory_) | 21 if (channel_factory_) |
| 22 channel_factory_->CancelChannelCreation(channel_name_); | 22 channel_factory_->CancelChannelCreation(channel_name_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void ChannelDispatcherBase::Init(MessageChannelFactory* channel_factory, | 25 void ChannelDispatcherBase::Init(MessageChannelFactory* channel_factory, |
| 26 EventHandler* event_handler) { | 26 EventHandler* event_handler) { |
| 27 channel_factory_ = channel_factory; | 27 channel_factory_ = channel_factory; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 50 event_handler_->OnChannelInitialized(this); | 50 event_handler_->OnChannelInitialized(this); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ChannelDispatcherBase::OnMessageReceived( | 53 void ChannelDispatcherBase::OnMessageReceived( |
| 54 std::unique_ptr<CompoundBuffer> message) { | 54 std::unique_ptr<CompoundBuffer> message) { |
| 55 OnIncomingMessage(std::move(message)); | 55 OnIncomingMessage(std::move(message)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ChannelDispatcherBase::OnMessagePipeClosed() { | 58 void ChannelDispatcherBase::OnMessagePipeClosed() { |
| 59 is_connected_ = false; | 59 is_connected_ = false; |
| 60 message_pipe_.reset(); |
| 60 event_handler_->OnChannelClosed(this); | 61 event_handler_->OnChannelClosed(this); |
| 61 } | 62 } |
| 62 | 63 |
| 63 } // namespace protocol | 64 } // namespace protocol |
| 64 } // namespace remoting | 65 } // namespace remoting |
| OLD | NEW |