From 21c7ff9afa9017603dd43007ce98939c2676a2c6 Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Tue, 6 Sep 2011 18:43:00 +0000 Subject: Add TCP configuration parameters for Transport API. BUG=91439 TEST=None Review URL: http://codereview.chromium.org/7820008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99776 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/p2p_transport.cc | 4 +++- webkit/glue/p2p_transport.h | 6 ++++++ webkit/plugins/ppapi/ppb_transport_impl.cc | 26 +++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) (limited to 'webkit') diff --git a/webkit/glue/p2p_transport.cc b/webkit/glue/p2p_transport.cc index 33d824f..a4c518b 100644 --- a/webkit/glue/p2p_transport.cc +++ b/webkit/glue/p2p_transport.cc @@ -10,7 +10,9 @@ P2PTransport::Config::Config() : stun_server_port(0), relay_server_port(0), tcp_receive_window(0), - tcp_send_window(0) { + tcp_send_window(0), + tcp_no_delay(false), + tcp_ack_delay_ms(0) { } P2PTransport::Config::~Config() { diff --git a/webkit/glue/p2p_transport.h b/webkit/glue/p2p_transport.h index 652117e..7795344 100644 --- a/webkit/glue/p2p_transport.h +++ b/webkit/glue/p2p_transport.h @@ -62,6 +62,12 @@ class P2PTransport { // TCP window sizes. Default size is used when set to 0. int tcp_receive_window; int tcp_send_window; + + // Disables Neagle's algorithm when set to true. + bool tcp_no_delay; + + // TCP ACK delay. + int tcp_ack_delay_ms; }; virtual ~P2PTransport() {} diff --git a/webkit/plugins/ppapi/ppb_transport_impl.cc b/webkit/plugins/ppapi/ppb_transport_impl.cc index f9d9cc1..e7779aa 100644 --- a/webkit/plugins/ppapi/ppb_transport_impl.cc +++ b/webkit/plugins/ppapi/ppb_transport_impl.cc @@ -33,6 +33,8 @@ const char kTcpProtocolName[] = "tcp"; const int kMinBufferSize = 1024; const int kMaxBufferSize = 1024 * 1024; +const int kMinAckDelay = 10; +const int kMaxAckDelay = 1000; int MapNetError(int result) { if (result > 0) @@ -170,6 +172,29 @@ int32_t PPB_Transport_Impl::SetProperty(PP_TransportProperty property, break; } + case PP_TRANSPORTPROPERTY_TCP_NO_DELAY: { + if (!use_tcp_) + return PP_ERROR_BADARGUMENT; + + if (value.type != PP_VARTYPE_BOOL) + return PP_ERROR_BADARGUMENT; + config_.tcp_no_delay = PP_ToBool(value.value.as_bool); + break; + } + + case PP_TRANSPORTPROPERTY_TCP_ACK_DELAY: { + if (!use_tcp_) + return PP_ERROR_BADARGUMENT; + + int32_t int_value = value.value.as_int; + if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay || + int_value > kMaxAckDelay) { + return PP_ERROR_BADARGUMENT; + } + config_.tcp_ack_delay_ms = int_value; + break; + } + default: return PP_ERROR_BADARGUMENT; } @@ -299,7 +324,6 @@ int32_t PPB_Transport_Impl::Close() { p2p_transport_.reset(); - PluginModule* plugin_module = ResourceHelper::GetPluginModule(this); if (plugin_module) plugin_module->GetCallbackTracker()->AbortAll(); -- cgit v1.1