summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-21 00:21:06 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-21 00:21:06 +0000
commit00e39bfff43983a6b8e45842482b35e557f5bffd (patch)
treee5f7cd40af6f5d41a011b1530e2ae0c400e177b1
parentc8a066de678599513b366931c56cee86b2190129 (diff)
downloadchromium_src-00e39bfff43983a6b8e45842482b35e557f5bffd.zip
chromium_src-00e39bfff43983a6b8e45842482b35e557f5bffd.tar.gz
chromium_src-00e39bfff43983a6b8e45842482b35e557f5bffd.tar.bz2
Add DISABLE_TCP_TRANSPORT flag in the Transport API.
The new property allows disabling TCP-based transport ports which improves performance for stream connections. BUG=41776 TEST=None Review URL: http://codereview.chromium.org/7888022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102060 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/p2p/port_allocator.cc9
-rw-r--r--ppapi/c/dev/ppb_transport_dev.h6
-rw-r--r--remoting/protocol/pepper_stream_channel.cc5
-rw-r--r--webkit/glue/p2p_transport.cc3
-rw-r--r--webkit/glue/p2p_transport.h5
-rw-r--r--webkit/plugins/ppapi/ppb_transport_impl.cc7
6 files changed, 31 insertions, 4 deletions
diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc
index 42df275..e0fac7a 100644
--- a/content/renderer/p2p/port_allocator.cc
+++ b/content/renderer/p2p/port_allocator.cc
@@ -11,6 +11,7 @@
#include "content/renderer/p2p/host_address_request.h"
#include "jingle/glue/utils.h"
#include "net/base/ip_endpoint.h"
+#include "ppapi/c/dev/ppb_transport_dev.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h"
@@ -59,6 +60,10 @@ P2PPortAllocator::P2PPortAllocator(
web_frame_(web_frame),
socket_dispatcher_(socket_dispatcher),
config_(config) {
+ uint32 flags = 0;
+ if (config_.disable_tcp_transport)
+ flags |= cricket::PORTALLOCATOR_DISABLE_TCP;
+ set_flags(flags);
}
P2PPortAllocator::~P2PPortAllocator() {
@@ -257,11 +262,11 @@ void P2PPortAllocatorSession::AddConfig() {
talk_base::SocketAddress address(relay_ip_.ip(), relay_udp_port_);
ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_UDP));
}
- if (relay_tcp_port_ > 0) {
+ if (relay_tcp_port_ > 0 && !allocator_->config_.disable_tcp_transport) {
talk_base::SocketAddress address(relay_ip_.ip(), relay_tcp_port_);
ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_TCP));
}
- if (relay_ssltcp_port_ > 0) {
+ if (relay_ssltcp_port_ > 0 && !allocator_->config_.disable_tcp_transport) {
talk_base::SocketAddress address(relay_ip_.ip(), relay_ssltcp_port_);
ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_SSLTCP));
}
diff --git a/ppapi/c/dev/ppb_transport_dev.h b/ppapi/c/dev/ppb_transport_dev.h
index 159b784..963bd17 100644
--- a/ppapi/c/dev/ppb_transport_dev.h
+++ b/ppapi/c/dev/ppb_transport_dev.h
@@ -53,7 +53,11 @@ typedef enum {
PP_TRANSPORTPROPERTY_TCP_NO_DELAY = 7,
// Delay for ACK packets in milliseconds. By default set to 100ms.
- PP_TRANSPORTPROPERTY_TCP_ACK_DELAY = 8
+ PP_TRANSPORTPROPERTY_TCP_ACK_DELAY = 8,
+
+ // Boolean value that disables TCP-based transports when set to
+ // true. By default set to false.
+ PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT = 9
} PP_TransportProperty;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TransportProperty, 4);
diff --git a/remoting/protocol/pepper_stream_channel.cc b/remoting/protocol/pepper_stream_channel.cc
index e6b07d8..1508ca3 100644
--- a/remoting/protocol/pepper_stream_channel.cc
+++ b/remoting/protocol/pepper_stream_channel.cc
@@ -143,6 +143,11 @@ void PepperStreamChannel::Connect(pp::Instance* pp_instance,
}
}
+ if (transport->SetProperty(PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT,
+ pp::Var(true)) != PP_OK) {
+ LOG(ERROR) << "Failed to set DISABLE_TCP_TRANSPORT flag.";
+ }
+
channel_ = new PepperTransportSocketAdapter(transport, name_, this);
owned_channel_.reset(channel_);
diff --git a/webkit/glue/p2p_transport.cc b/webkit/glue/p2p_transport.cc
index f79c21f..1dcb1d5 100644
--- a/webkit/glue/p2p_transport.cc
+++ b/webkit/glue/p2p_transport.cc
@@ -13,7 +13,8 @@ P2PTransport::Config::Config()
tcp_receive_window(0),
tcp_send_window(0),
tcp_no_delay(false),
- tcp_ack_delay_ms(0) {
+ tcp_ack_delay_ms(0),
+ disable_tcp_transport(false) {
}
P2PTransport::Config::~Config() {
diff --git a/webkit/glue/p2p_transport.h b/webkit/glue/p2p_transport.h
index 8e77d28..b60101a 100644
--- a/webkit/glue/p2p_transport.h
+++ b/webkit/glue/p2p_transport.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "base/basictypes.h"
+
namespace net {
class Socket;
} // namespace net
@@ -79,6 +81,9 @@ class P2PTransport {
// TCP ACK delay.
int tcp_ack_delay_ms;
+
+ // Disable TCP-based transport when set to true.
+ bool disable_tcp_transport;
};
virtual ~P2PTransport() {}
diff --git a/webkit/plugins/ppapi/ppb_transport_impl.cc b/webkit/plugins/ppapi/ppb_transport_impl.cc
index 1fd89d8..efed706 100644
--- a/webkit/plugins/ppapi/ppb_transport_impl.cc
+++ b/webkit/plugins/ppapi/ppb_transport_impl.cc
@@ -223,6 +223,13 @@ int32_t PPB_Transport_Impl::SetProperty(PP_TransportProperty property,
break;
}
+ case PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT: {
+ if (value.type != PP_VARTYPE_BOOL)
+ return PP_ERROR_BADARGUMENT;
+ config_.disable_tcp_transport = PP_ToBool(value.value.as_bool);
+ break;
+ }
+
default:
return PP_ERROR_BADARGUMENT;
}