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

Side by Side Diff: remoting/protocol/stream_message_pipe_adapter.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, 4 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/message_pipe.h ('k') | remoting/protocol/webrtc_connection_to_client.cc » ('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 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 24 matching lines...) Expand all
35 } 35 }
36 36
37 StreamMessagePipeAdapter::~StreamMessagePipeAdapter() {} 37 StreamMessagePipeAdapter::~StreamMessagePipeAdapter() {}
38 38
39 void StreamMessagePipeAdapter::Start(EventHandler* event_handler) { 39 void StreamMessagePipeAdapter::Start(EventHandler* event_handler) {
40 reader_.StartReading(socket_.get(), 40 reader_.StartReading(socket_.get(),
41 base::Bind(&EventHandler::OnMessageReceived, 41 base::Bind(&EventHandler::OnMessageReceived,
42 base::Unretained(event_handler)), 42 base::Unretained(event_handler)),
43 base::Bind(&StreamMessagePipeAdapter::CloseOnError, 43 base::Bind(&StreamMessagePipeAdapter::CloseOnError,
44 base::Unretained(this))); 44 base::Unretained(this)));
45 event_handler->OnMessagePipeOpen();
45 } 46 }
46 47
47 void StreamMessagePipeAdapter::Send(google::protobuf::MessageLite* message, 48 void StreamMessagePipeAdapter::Send(google::protobuf::MessageLite* message,
48 const base::Closure& done) { 49 const base::Closure& done) {
49 if (writer_) 50 if (writer_)
50 writer_->Write(SerializeAndFrameMessage(*message), done); 51 writer_->Write(SerializeAndFrameMessage(*message), done);
51 } 52 }
52 53
53 void StreamMessagePipeAdapter::CloseOnError(int error) { 54 void StreamMessagePipeAdapter::CloseOnError(int error) {
54 // Stop writing on error. 55 // Stop writing on error.
(...skipping 30 matching lines...) Expand all
85 if (!socket) { 86 if (!socket) {
86 error_callback_.Run(net::ERR_FAILED); 87 error_callback_.Run(net::ERR_FAILED);
87 return; 88 return;
88 } 89 }
89 callback.Run(base::WrapUnique( 90 callback.Run(base::WrapUnique(
90 new StreamMessagePipeAdapter(std::move(socket), error_callback_))); 91 new StreamMessagePipeAdapter(std::move(socket), error_callback_)));
91 } 92 }
92 93
93 } // namespace protocol 94 } // namespace protocol
94 } // namespace remoting 95 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/message_pipe.h ('k') | remoting/protocol/webrtc_connection_to_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698