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

Side by Side Diff: remoting/protocol/stream_message_pipe_adapter.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/stream_message_pipe_adapter.h" 5 #include "remoting/protocol/stream_message_pipe_adapter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 18 matching lines...) Expand all
29 DCHECK(!error_callback_.is_null()); 29 DCHECK(!error_callback_.is_null());
30 30
31 writer_->Start( 31 writer_->Start(
32 base::Bind(&P2PStreamSocket::Write, base::Unretained(socket_.get())), 32 base::Bind(&P2PStreamSocket::Write, base::Unretained(socket_.get())),
33 base::Bind(&StreamMessagePipeAdapter::CloseOnError, 33 base::Bind(&StreamMessagePipeAdapter::CloseOnError,
34 base::Unretained(this))); 34 base::Unretained(this)));
35 } 35 }
36 36
37 StreamMessagePipeAdapter::~StreamMessagePipeAdapter() {} 37 StreamMessagePipeAdapter::~StreamMessagePipeAdapter() {}
38 38
39 void StreamMessagePipeAdapter::StartReceiving( 39 void StreamMessagePipeAdapter::Start(EventHandler* event_handler) {
40 const MessageReceivedCallback& callback) { 40 reader_.StartReading(socket_.get(),
41 reader_.StartReading(socket_.get(), callback, 41 base::Bind(&EventHandler::OnMessageReceived,
42 base::Unretained(event_handler)),
42 base::Bind(&StreamMessagePipeAdapter::CloseOnError, 43 base::Bind(&StreamMessagePipeAdapter::CloseOnError,
43 base::Unretained(this))); 44 base::Unretained(this)));
44 } 45 }
45 46
46 void StreamMessagePipeAdapter::Send(google::protobuf::MessageLite* message, 47 void StreamMessagePipeAdapter::Send(google::protobuf::MessageLite* message,
47 const base::Closure& done) { 48 const base::Closure& done) {
48 if (writer_) 49 if (writer_)
49 writer_->Write(SerializeAndFrameMessage(*message), done); 50 writer_->Write(SerializeAndFrameMessage(*message), done);
50 } 51 }
51 52
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (!socket) { 85 if (!socket) {
85 error_callback_.Run(net::ERR_FAILED); 86 error_callback_.Run(net::ERR_FAILED);
86 return; 87 return;
87 } 88 }
88 callback.Run(base::WrapUnique( 89 callback.Run(base::WrapUnique(
89 new StreamMessagePipeAdapter(std::move(socket), error_callback_))); 90 new StreamMessagePipeAdapter(std::move(socket), error_callback_)));
90 } 91 }
91 92
92 } // namespace protocol 93 } // namespace protocol
93 } // namespace remoting 94 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/stream_message_pipe_adapter.h ('k') | remoting/protocol/webrtc_connection_to_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698