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

Unified Diff: src/trusted/plugin/srpc/desc_based_handle.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/desc_based_handle.h ('k') | src/trusted/plugin/srpc/method_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/plugin/srpc/desc_based_handle.cc
===================================================================
--- src/trusted/plugin/srpc/desc_based_handle.cc (revision 2716)
+++ src/trusted/plugin/srpc/desc_based_handle.cc (working copy)
@@ -1,95 +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 <setjmp.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <map>
-
-#include "native_client/src/trusted/plugin/srpc/browser_interface.h"
-#include "native_client/src/trusted/plugin/srpc/desc_based_handle.h"
-#include "native_client/src/trusted/plugin/srpc/portable_handle.h"
-#include "native_client/src/trusted/plugin/srpc/shared_memory.h"
-#include "native_client/src/trusted/plugin/srpc/plugin.h"
-
-#include "native_client/src/trusted/plugin/srpc/scriptable_handle.h"
-
-namespace {
-
-bool Map(void* obj, plugin::SrpcParams* params) {
- plugin::DescBasedHandle *ptr =
- reinterpret_cast<plugin::DescBasedHandle*>(obj);
- // Create a copy of the wrapper to go on the SharedMemory object.
- nacl::DescWrapper* shm_wrapper =
- ptr->plugin()->wrapper_factory()->MakeGeneric(ptr->wrapper()->desc());
- // Increment the ref count of the contained object.
- NaClDescRef(shm_wrapper->desc());
-
- plugin::SharedMemory* portable_shared_memory =
- plugin::SharedMemory::New(ptr->plugin(), shm_wrapper);
- plugin::ScriptableHandle* shared_memory =
- ptr->browser_interface()->NewScriptableHandle(portable_shared_memory);
- if (NULL == shared_memory) {
- return false;
- }
- PLUGIN_PRINTF(("ScriptableHandle::Invoke: new returned %p\n",
- static_cast<void*>(shared_memory)));
- params->outs()[0]->tag = NACL_SRPC_ARG_TYPE_OBJECT;
- params->outs()[0]->u.oval = shared_memory;
- return true;
-}
-
-} // namespace
-
-namespace plugin {
-
-DescBasedHandle::DescBasedHandle(): plugin_(NULL),
- wrapper_(NULL) {
- PLUGIN_PRINTF(("DescBasedHandle::DescBasedHandle(%p)\n",
- static_cast<void*>(this)));
-}
-
-DescBasedHandle::~DescBasedHandle() {
- PLUGIN_PRINTF(("DescBasedHandle::~DescBasedHandle(%p)\n",
- static_cast<void*>(this)));
- if (NULL != wrapper_) {
- wrapper_->Delete();
- wrapper_ = NULL;
- }
-}
-
-DescBasedHandle* DescBasedHandle::New(Plugin* plugin,
- nacl::DescWrapper* wrapper) {
- PLUGIN_PRINTF(("DescBasedHandle::New()\n"));
-
- DescBasedHandle* desc_based_handle = new(std::nothrow) DescBasedHandle();
-
- if (desc_based_handle == NULL || !desc_based_handle->Init(plugin, wrapper)) {
- return NULL;
- }
-
- return desc_based_handle;
-}
-
-bool DescBasedHandle::Init(Plugin* plugin, nacl::DescWrapper* wrapper) {
- plugin_ = plugin;
- wrapper_ = wrapper;
- LoadMethods();
- return true;
-}
-
-BrowserInterface* DescBasedHandle::browser_interface() const {
- return plugin_->browser_interface();
-}
-
-void DescBasedHandle::LoadMethods() {
- // Methods supported by DescBasedHandle.
- AddMethodCall(Map, "map", "", "h");
-}
-
-} // namespace plugin
« no previous file with comments | « src/trusted/plugin/srpc/desc_based_handle.h ('k') | src/trusted/plugin/srpc/method_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698