OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pseudotcp_channel_factory.h" | 5 #include "remoting/protocol/pseudotcp_channel_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
10 #include "remoting/protocol/datagram_channel_factory.h" | 10 #include "remoting/protocol/datagram_channel_factory.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } else { | 53 } else { |
54 delete it->second; | 54 delete it->second; |
55 pending_sockets_.erase(it); | 55 pending_sockets_.erase(it); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 void PseudoTcpChannelFactory::OnDatagramChannelCreated( | 59 void PseudoTcpChannelFactory::OnDatagramChannelCreated( |
60 const std::string& name, | 60 const std::string& name, |
61 const ChannelCreatedCallback& callback, | 61 const ChannelCreatedCallback& callback, |
62 scoped_ptr<P2PDatagramSocket> datagram_socket) { | 62 scoped_ptr<P2PDatagramSocket> datagram_socket) { |
63 PseudoTcpAdapter* adapter = new PseudoTcpAdapter(datagram_socket.Pass()); | 63 PseudoTcpAdapter* adapter = new PseudoTcpAdapter(std::move(datagram_socket)); |
64 pending_sockets_[name] = adapter; | 64 pending_sockets_[name] = adapter; |
65 | 65 |
66 adapter->SetSendBufferSize(kTcpSendBufferSize); | 66 adapter->SetSendBufferSize(kTcpSendBufferSize); |
67 adapter->SetReceiveBufferSize(kTcpReceiveBufferSize); | 67 adapter->SetReceiveBufferSize(kTcpReceiveBufferSize); |
68 adapter->SetNoDelay(true); | 68 adapter->SetNoDelay(true); |
69 adapter->SetAckDelay(kTcpAckDelayMilliseconds); | 69 adapter->SetAckDelay(kTcpAckDelayMilliseconds); |
70 | 70 |
71 // TODO(sergeyu): This is a hack to improve latency of the video channel. | 71 // TODO(sergeyu): This is a hack to improve latency of the video channel. |
72 // Consider removing it once we have better flow control implemented. | 72 // Consider removing it once we have better flow control implemented. |
73 if (name == kVideoChannelName) | 73 if (name == kVideoChannelName) |
(...skipping 11 matching lines...) Expand all Loading... |
85 const ChannelCreatedCallback& callback, | 85 const ChannelCreatedCallback& callback, |
86 int result) { | 86 int result) { |
87 PendingSocketsMap::iterator it = pending_sockets_.find(name); | 87 PendingSocketsMap::iterator it = pending_sockets_.find(name); |
88 DCHECK(it != pending_sockets_.end()); | 88 DCHECK(it != pending_sockets_.end()); |
89 scoped_ptr<P2PStreamSocket> socket(it->second); | 89 scoped_ptr<P2PStreamSocket> socket(it->second); |
90 pending_sockets_.erase(it); | 90 pending_sockets_.erase(it); |
91 | 91 |
92 if (result != net::OK) | 92 if (result != net::OK) |
93 socket.reset(); | 93 socket.reset(); |
94 | 94 |
95 callback.Run(socket.Pass()); | 95 callback.Run(std::move(socket)); |
96 } | 96 } |
97 | 97 |
98 } // namespace protocol | 98 } // namespace protocol |
99 } // namespace remoting | 99 } // namespace remoting |
OLD | NEW |