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

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 12220050: Provide a way to disable Nagle's algorithm on Pepper TCP sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 new PpapiHostMsg_PPBTCPSocket_Read(socket_id, bytes_to_read)); 1173 new PpapiHostMsg_PPBTCPSocket_Read(socket_id, bytes_to_read));
1174 } 1174 }
1175 1175
1176 void PepperPluginDelegateImpl::TCPSocketWrite(uint32 socket_id, 1176 void PepperPluginDelegateImpl::TCPSocketWrite(uint32 socket_id,
1177 const std::string& buffer) { 1177 const std::string& buffer) {
1178 DCHECK(tcp_sockets_.Lookup(socket_id)); 1178 DCHECK(tcp_sockets_.Lookup(socket_id));
1179 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Write(socket_id, buffer)); 1179 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Write(socket_id, buffer));
1180 } 1180 }
1181 1181
1182 void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) { 1182 void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) {
1183 // There are no DCHECK(tcp_sockets_.Lookup(socket_id)) because it 1183 // There is no DCHECK(tcp_sockets_.Lookup(socket_id)) because this method
1184 // can be called before 1184 // can be called before TCPSocketConnect or TCPSocketConnectWithNetAddress.
1185 // TCPSocketConnect/TCPSocketConnectWithNetAddress is called.
1186 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id)); 1185 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id));
1187 if (tcp_sockets_.Lookup(socket_id)) 1186 if (tcp_sockets_.Lookup(socket_id))
1188 tcp_sockets_.Remove(socket_id); 1187 tcp_sockets_.Remove(socket_id);
1189 } 1188 }
1190 1189
1190 void PepperPluginDelegateImpl::TCPSocketSetBoolOption(
1191 uint32 socket_id,
1192 PP_TCPSocketOption_Private name,
1193 bool value) {
1194 DCHECK(tcp_sockets_.Lookup(socket_id));
1195 render_view_->Send(
1196 new PpapiHostMsg_PPBTCPSocket_SetBoolOption(socket_id, name, value));
1197 }
1198
1191 void PepperPluginDelegateImpl::RegisterTCPSocket( 1199 void PepperPluginDelegateImpl::RegisterTCPSocket(
1192 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, 1200 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket,
1193 uint32 socket_id) { 1201 uint32 socket_id) {
1194 tcp_sockets_.AddWithID(socket, socket_id); 1202 tcp_sockets_.AddWithID(socket, socket_id);
1195 } 1203 }
1196 1204
1197 void PepperPluginDelegateImpl::TCPServerSocketListen( 1205 void PepperPluginDelegateImpl::TCPServerSocketListen(
1198 PP_Resource socket_resource, 1206 PP_Resource socket_resource,
1199 const PP_NetAddress_Private& addr, 1207 const PP_NetAddress_Private& addr,
1200 int32_t backlog) { 1208 int32_t backlog) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 1402
1395 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { 1403 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
1396 bool handled = true; 1404 bool handled = true;
1397 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) 1405 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message)
1398 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, 1406 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
1399 OnTCPSocketConnectACK) 1407 OnTCPSocketConnectACK)
1400 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, 1408 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
1401 OnTCPSocketSSLHandshakeACK) 1409 OnTCPSocketSSLHandshakeACK)
1402 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) 1410 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
1403 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) 1411 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
1412 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetBoolOptionACK,
1413 OnTCPSocketSetBoolOptionACK)
1404 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, 1414 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK,
1405 OnTCPServerSocketListenACK) 1415 OnTCPServerSocketListenACK)
1406 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, 1416 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK,
1407 OnTCPServerSocketAcceptACK) 1417 OnTCPServerSocketAcceptACK)
1408 IPC_MESSAGE_UNHANDLED(handled = false) 1418 IPC_MESSAGE_UNHANDLED(handled = false)
1409 IPC_END_MESSAGE_MAP() 1419 IPC_END_MESSAGE_MAP()
1410 return handled; 1420 return handled;
1411 } 1421 }
1412 1422
1413 void PepperPluginDelegateImpl::OnDestruct() { 1423 void PepperPluginDelegateImpl::OnDestruct() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 void PepperPluginDelegateImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id, 1464 void PepperPluginDelegateImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
1455 uint32 socket_id, 1465 uint32 socket_id,
1456 bool succeeded, 1466 bool succeeded,
1457 int32_t bytes_written) { 1467 int32_t bytes_written) {
1458 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = 1468 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket =
1459 tcp_sockets_.Lookup(socket_id); 1469 tcp_sockets_.Lookup(socket_id);
1460 if (socket) 1470 if (socket)
1461 socket->OnWriteCompleted(succeeded, bytes_written); 1471 socket->OnWriteCompleted(succeeded, bytes_written);
1462 } 1472 }
1463 1473
1474 void PepperPluginDelegateImpl::OnTCPSocketSetBoolOptionACK(
1475 uint32 plugin_dispatcher_id,
1476 uint32 socket_id,
1477 bool succeeded) {
1478 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket =
1479 tcp_sockets_.Lookup(socket_id);
1480 if (socket)
1481 socket->OnSetOptionCompleted(succeeded);
1482 }
1483
1464 void PepperPluginDelegateImpl::OnTCPServerSocketListenACK( 1484 void PepperPluginDelegateImpl::OnTCPServerSocketListenACK(
1465 uint32 plugin_dispatcher_id, 1485 uint32 plugin_dispatcher_id,
1466 PP_Resource socket_resource, 1486 PP_Resource socket_resource,
1467 uint32 socket_id, 1487 uint32 socket_id,
1468 int32_t status) { 1488 int32_t status) {
1469 ppapi::thunk::EnterResource<ppapi::thunk::PPB_TCPServerSocket_Private_API> 1489 ppapi::thunk::EnterResource<ppapi::thunk::PPB_TCPServerSocket_Private_API>
1470 enter(socket_resource, true); 1490 enter(socket_resource, true);
1471 if (enter.succeeded()) { 1491 if (enter.succeeded()) {
1472 ppapi::PPB_TCPServerSocket_Shared* socket = 1492 ppapi::PPB_TCPServerSocket_Shared* socket =
1473 static_cast<ppapi::PPB_TCPServerSocket_Shared*>(enter.object()); 1493 static_cast<ppapi::PPB_TCPServerSocket_Shared*>(enter.object());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 RenderWidgetFullscreenPepper* container = 1613 RenderWidgetFullscreenPepper* container =
1594 static_cast<RenderWidgetFullscreenPepper*>( 1614 static_cast<RenderWidgetFullscreenPepper*>(
1595 instance->fullscreen_container()); 1615 instance->fullscreen_container());
1596 return container->mouse_lock_dispatcher(); 1616 return container->mouse_lock_dispatcher();
1597 } else { 1617 } else {
1598 return render_view_->mouse_lock_dispatcher(); 1618 return render_view_->mouse_lock_dispatcher();
1599 } 1619 }
1600 } 1620 }
1601 1621
1602 } // namespace content 1622 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_delegate_impl.h ('k') | ppapi/api/private/ppb_tcp_socket_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698