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

Unified Diff: src/trusted/plugin/srpc/socket_address.cc

Issue 2981011: Move plugin/srpc contents to the more appropriately named plugin/common.... (Closed) Base URL: http://nativeclient.googlecode.com/svn/trunk/src/native_client/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/plugin/srpc/socket_address.h ('k') | src/trusted/plugin/srpc/srpc_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/plugin/srpc/socket_address.cc
===================================================================
--- src/trusted/plugin/srpc/socket_address.cc (revision 2716)
+++ src/trusted/plugin/srpc/socket_address.cc (working copy)
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008 The Native Client Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can
- * be found in the LICENSE file.
- */
-
-
-#include <signal.h>
-#include <string.h>
-#include "native_client/src/trusted/plugin/srpc/browser_interface.h"
-#include "native_client/src/trusted/plugin/srpc/connected_socket.h"
-#include "native_client/src/trusted/plugin/srpc/plugin.h"
-#include "native_client/src/trusted/plugin/srpc/socket_address.h"
-
-#include "native_client/src/trusted/plugin/srpc/scriptable_handle.h"
-
-#include "native_client/src/trusted/plugin/srpc/utility.h"
-
-namespace {
-
-bool RpcConnect(void* obj, plugin::SrpcParams *params) {
- plugin::SocketAddress* socket_addr =
- reinterpret_cast<plugin::SocketAddress*>(obj);
- plugin::ScriptableHandle* connected_socket = socket_addr->Connect();
- if (NULL == connected_socket) {
- return false;
- }
- params->outs()[0]->tag = NACL_SRPC_ARG_TYPE_OBJECT;
- params->outs()[0]->u.oval = connected_socket;
- return true;
-}
-
-} // namespace
-
-namespace plugin {
-
-SocketAddress* SocketAddress::New(Plugin* plugin, nacl::DescWrapper* wrapper) {
- PLUGIN_PRINTF(("SocketAddress::New()\n"));
- SocketAddress* socket_address = new(std::nothrow) SocketAddress();
- if (socket_address == NULL || !socket_address->Init(plugin, wrapper)) {
- delete socket_address;
- return NULL;
- }
- return socket_address;
-}
-
-bool SocketAddress::Init(Plugin* plugin, nacl::DescWrapper* wrapper) {
- if (!DescBasedHandle::Init(plugin, wrapper)) {
- return false;
- }
- LoadMethods();
- return true;
-}
-
-void SocketAddress::LoadMethods() {
- // Methods implemented by SocketAddresses.
- AddMethodCall(RpcConnect, "connect", "", "h");
-}
-
-SocketAddress::SocketAddress() {
- PLUGIN_PRINTF(("SocketAddress::SocketAddress(%p)\n",
- static_cast<void*>(this)));
-}
-
-SocketAddress::~SocketAddress() {
- PLUGIN_PRINTF(("SocketAddress::~SocketAddress(%p)\n",
- static_cast<void*>(this)));
-}
-
-// Returns a connected socket for the address.
-ScriptableHandle* SocketAddress::Connect() {
- PLUGIN_PRINTF(("SocketAddress::Connect()\n"));
- nacl::DescWrapper* con_desc = wrapper()->Connect();
- if (NULL == con_desc) {
- PLUGIN_PRINTF(("SocketAddress::Connect: connect failed\n"));
- return NULL;
- } else {
- PLUGIN_PRINTF(("SocketAddress::Connect: take returned %p\n",
- static_cast<void*>(con_desc)));
- ConnectedSocket* portable_connected_socket =
- ConnectedSocket::New(plugin(), con_desc);
- ScriptableHandle* connected_socket =
- plugin()->browser_interface()->NewScriptableHandle(
- portable_connected_socket);
- PLUGIN_PRINTF(("SocketAddress::Connect: CS returned %p\n",
- static_cast<void*>(connected_socket)));
- return connected_socket;
- }
-}
-
-} // namespace plugin
« no previous file with comments | « src/trusted/plugin/srpc/socket_address.h ('k') | src/trusted/plugin/srpc/srpc_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698