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

Side by Side Diff: remoting/protocol/channel_dispatcher_base.cc

Issue 2164163002: Simplify data channel creation logic in WebRTC-based protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.h ('k') | remoting/protocol/connection_tester.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.h ('k') | remoting/protocol/connection_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698