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

Unified Diff: ppapi/thunk/ppb_tcp_socket_thunk.cc

Issue 24195004: PPB_TCPSocket: add support for TCP server socket operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/thunk/ppb_tcp_socket_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_tcp_socket_thunk.cc
diff --git a/ppapi/thunk/ppb_tcp_socket_thunk.cc b/ppapi/thunk/ppb_tcp_socket_thunk.cc
index ff612fb54dbe7310f586e665102c515e7bace35f..42ae702e5e395b393be900b4f122e84259192f9a 100644
--- a/ppapi/thunk/ppb_tcp_socket_thunk.cc
+++ b/ppapi/thunk/ppb_tcp_socket_thunk.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// From ppb_tcp_socket.idl modified Thu Jun 20 16:36:53 2013.
+// From ppb_tcp_socket.idl modified Sun Sep 15 16:14:21 2013.
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
@@ -19,6 +19,14 @@ namespace thunk {
namespace {
+PP_Resource Create_1_0(PP_Instance instance) {
+ VLOG(4) << "PPB_TCPSocket::Create_1_0()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTCPSocket1_0(instance);
+}
+
PP_Resource Create(PP_Instance instance) {
VLOG(4) << "PPB_TCPSocket::Create()";
EnterResourceCreation enter(instance);
@@ -33,6 +41,16 @@ PP_Bool IsTCPSocket(PP_Resource resource) {
return PP_FromBool(enter.succeeded());
}
+int32_t Bind(PP_Resource tcp_socket,
+ PP_Resource addr,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TCPSocket::Bind()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Bind(addr, enter.callback()));
+}
+
int32_t Connect(PP_Resource tcp_socket,
PP_Resource addr,
struct PP_CompletionCallback callback) {
@@ -85,6 +103,27 @@ int32_t Write(PP_Resource tcp_socket,
enter.callback()));
}
+int32_t Listen(PP_Resource tcp_socket,
+ int32_t backlog,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TCPSocket::Listen()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Listen(backlog, enter.callback()));
+}
+
+int32_t Accept(PP_Resource tcp_socket,
+ PP_Resource* accepted_tcp_socket,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TCPSocket::Accept()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Accept(accepted_tcp_socket,
+ enter.callback()));
+}
+
void Close(PP_Resource tcp_socket) {
VLOG(4) << "PPB_TCPSocket::Close()";
EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true);
@@ -107,13 +146,28 @@ int32_t SetOption(PP_Resource tcp_socket,
}
const PPB_TCPSocket_1_0 g_ppb_tcpsocket_thunk_1_0 = {
+ &Create_1_0,
+ &IsTCPSocket,
+ &Connect,
+ &GetLocalAddress,
+ &GetRemoteAddress,
+ &Read,
+ &Write,
+ &Close,
+ &SetOption
+};
+
+const PPB_TCPSocket_1_1 g_ppb_tcpsocket_thunk_1_1 = {
&Create,
&IsTCPSocket,
+ &Bind,
&Connect,
&GetLocalAddress,
&GetRemoteAddress,
&Read,
&Write,
+ &Listen,
+ &Accept,
&Close,
&SetOption
};
@@ -124,5 +178,9 @@ const PPB_TCPSocket_1_0* GetPPB_TCPSocket_1_0_Thunk() {
return &g_ppb_tcpsocket_thunk_1_0;
}
+const PPB_TCPSocket_1_1* GetPPB_TCPSocket_1_1_Thunk() {
+ return &g_ppb_tcpsocket_thunk_1_1;
+}
+
} // namespace thunk
} // namespace ppapi
« no previous file with comments | « ppapi/thunk/ppb_tcp_socket_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698