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

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

Issue 2146213002: Add support for dynamic channels in WebrtcTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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
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 13 matching lines...) Expand all
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;
28 event_handler_ = event_handler; 28 event_handler_ = event_handler;
29 29
30 channel_factory_->CreateChannel(channel_name_, base::Bind( 30 channel_factory_->CreateChannel(channel_name_, base::Bind(
31 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this))); 31 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this)));
32 } 32 }
33 33
34 void ChannelDispatcherBase::Init(std::unique_ptr<MessagePipe> message_pipe,
35 EventHandler* event_handler) {
36 event_handler_ = event_handler;
37 OnChannelReady(std::move(message_pipe));
38 }
39
34 void ChannelDispatcherBase::OnChannelReady( 40 void ChannelDispatcherBase::OnChannelReady(
35 std::unique_ptr<MessagePipe> message_pipe) { 41 std::unique_ptr<MessagePipe> message_pipe) {
36 channel_factory_ = nullptr; 42 channel_factory_ = nullptr;
37 message_pipe_ = std::move(message_pipe); 43 message_pipe_ = std::move(message_pipe);
38 message_pipe_->StartReceiving(base::Bind( 44 message_pipe_->Start(this);
39 &ChannelDispatcherBase::OnIncomingMessage, base::Unretained(this)));
40 45
41 event_handler_->OnChannelInitialized(this); 46 event_handler_->OnChannelInitialized(this);
42 } 47 }
43 48
49 void ChannelDispatcherBase::OnMessageReceived(
50 std::unique_ptr<CompoundBuffer> message) {
51 OnIncomingMessage(std::move(message));
52 }
53
54 void ChannelDispatcherBase::OnMessagePipeClosed() {
55 event_handler_->OnChannelClosed(this);
56 }
57
44 } // namespace protocol 58 } // namespace protocol
45 } // namespace remoting 59 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.h ('k') | remoting/protocol/client_video_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698