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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 EventHandler* event_handler) { | 35 EventHandler* event_handler) { |
36 event_handler_ = event_handler; | 36 event_handler_ = event_handler; |
37 OnChannelReady(std::move(message_pipe)); | 37 OnChannelReady(std::move(message_pipe)); |
38 } | 38 } |
39 | 39 |
40 void ChannelDispatcherBase::OnChannelReady( | 40 void ChannelDispatcherBase::OnChannelReady( |
41 std::unique_ptr<MessagePipe> message_pipe) { | 41 std::unique_ptr<MessagePipe> message_pipe) { |
42 channel_factory_ = nullptr; | 42 channel_factory_ = nullptr; |
43 message_pipe_ = std::move(message_pipe); | 43 message_pipe_ = std::move(message_pipe); |
44 message_pipe_->Start(this); | 44 message_pipe_->Start(this); |
| 45 } |
45 | 46 |
| 47 void ChannelDispatcherBase::OnMessagePipeOpen() { |
| 48 DCHECK(!is_connected_); |
| 49 is_connected_ = true; |
46 event_handler_->OnChannelInitialized(this); | 50 event_handler_->OnChannelInitialized(this); |
47 } | 51 } |
48 | 52 |
49 void ChannelDispatcherBase::OnMessageReceived( | 53 void ChannelDispatcherBase::OnMessageReceived( |
50 std::unique_ptr<CompoundBuffer> message) { | 54 std::unique_ptr<CompoundBuffer> message) { |
51 OnIncomingMessage(std::move(message)); | 55 OnIncomingMessage(std::move(message)); |
52 } | 56 } |
53 | 57 |
54 void ChannelDispatcherBase::OnMessagePipeClosed() { | 58 void ChannelDispatcherBase::OnMessagePipeClosed() { |
| 59 is_connected_ = false; |
55 event_handler_->OnChannelClosed(this); | 60 event_handler_->OnChannelClosed(this); |
56 } | 61 } |
57 | 62 |
58 } // namespace protocol | 63 } // namespace protocol |
59 } // namespace remoting | 64 } // namespace remoting |
OLD | NEW |