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

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

Issue 1177983009: Move remoting-specific adapters from jingle/glue to remoting/protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/pseudotcp_adapter_unittest.cc ('k') | remoting/remoting_srcs.gypi » ('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 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 "jingle/glue/pseudotcp_adapter.h"
9 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
10 #include "net/socket/stream_socket.h" 9 #include "net/socket/stream_socket.h"
11 #include "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
12 #include "remoting/protocol/datagram_channel_factory.h" 11 #include "remoting/protocol/datagram_channel_factory.h"
12 #include "remoting/protocol/pseudotcp_adapter.h"
13 13
14 namespace remoting { 14 namespace remoting {
15 namespace protocol { 15 namespace protocol {
16 16
17 namespace { 17 namespace {
18 18
19 // Value is chosen to balance the extra latency against the reduced 19 // Value is chosen to balance the extra latency against the reduced
20 // load due to ACK traffic. 20 // load due to ACK traffic.
21 const int kTcpAckDelayMilliseconds = 10; 21 const int kTcpAckDelayMilliseconds = 10;
22 22
(...skipping 30 matching lines...) Expand all
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<net::Socket> datagram_socket) { 62 scoped_ptr<net::Socket> datagram_socket) {
63 jingle_glue::PseudoTcpAdapter* adapter = 63 PseudoTcpAdapter* adapter = new PseudoTcpAdapter(datagram_socket.Pass());
64 new jingle_glue::PseudoTcpAdapter(datagram_socket.release());
65 pending_sockets_[name] = adapter; 64 pending_sockets_[name] = adapter;
66 65
67 adapter->SetSendBufferSize(kTcpSendBufferSize); 66 adapter->SetSendBufferSize(kTcpSendBufferSize);
68 adapter->SetReceiveBufferSize(kTcpReceiveBufferSize); 67 adapter->SetReceiveBufferSize(kTcpReceiveBufferSize);
69 adapter->SetNoDelay(true); 68 adapter->SetNoDelay(true);
70 adapter->SetAckDelay(kTcpAckDelayMilliseconds); 69 adapter->SetAckDelay(kTcpAckDelayMilliseconds);
71 70
72 // 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.
73 // Consider removing it once we have better flow control implemented. 72 // Consider removing it once we have better flow control implemented.
74 if (name == kVideoChannelName) 73 if (name == kVideoChannelName)
(...skipping 16 matching lines...) Expand all
91 pending_sockets_.erase(it); 90 pending_sockets_.erase(it);
92 91
93 if (result != net::OK) 92 if (result != net::OK)
94 socket.reset(); 93 socket.reset();
95 94
96 callback.Run(socket.Pass()); 95 callback.Run(socket.Pass());
97 } 96 }
98 97
99 } // namespace protocol 98 } // namespace protocol
100 } // namespace remoting 99 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/pseudotcp_adapter_unittest.cc ('k') | remoting/remoting_srcs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698