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

Unified Diff: o3d/gpu_plugin/system_services/shared_memory.h

Issue 194049: Implemented shared memory as an NPObject. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
Index: o3d/gpu_plugin/system_services/shared_memory.h
===================================================================
--- o3d/gpu_plugin/system_services/shared_memory.h (revision 0)
+++ o3d/gpu_plugin/system_services/shared_memory.h (revision 0)
@@ -0,0 +1,55 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef O3D_GPU_PLUGIN_SYSTEM_SERVICES_SHARED_MEMORY_H_
+#define O3D_GPU_PLUGIN_SYSTEM_SERVICES_SHARED_MEMORY_H_
+
+#include "base/shared_memory.h"
+#include "o3d/gpu_plugin/np_utils/default_np_object.h"
+#include "o3d/gpu_plugin/np_utils/np_dispatcher.h"
+#include "o3d/gpu_plugin/np_utils/np_object_pointer.h"
+#include "o3d/gpu_plugin/system_services/shared_memory_public.h"
+#include "third_party/npapi/bindings/npruntime.h"
+
+namespace o3d {
+namespace gpu_plugin {
+
+// An NPObject holding a shared memory handle.
+class SharedMemory : public DefaultNPObject<CHRSharedMemory> {
+ public:
+ explicit SharedMemory(NPP npp);
+ ~SharedMemory();
+
+ // Initialize from an existing base::SharedMemory. Takes ownership of the
+ // base::SharedMemory.
+ void Initialize(base::SharedMemory* shared_memory, int32 size);
+
+ virtual bool Initialize(int32 size);
+
+ virtual int32 GetSize() {
+ return size;
+ }
+
+ virtual bool Map();
+
+ base::SharedMemory* shared_memory() const {
+ return shared_memory_;
+ }
+
+ NP_UTILS_BEGIN_DISPATCHER_CHAIN(SharedMemory, DefaultNPObject<NPObject>)
+ NP_UTILS_DISPATCHER(Initialize, bool(int32));
+ NP_UTILS_DISPATCHER(GetSize, int32())
+ NP_UTILS_DISPATCHER(Map, bool())
+ NP_UTILS_END_DISPATCHER_CHAIN
+
+ private:
+ NPP npp_;
+ base::SharedMemory* shared_memory_;
+ DISALLOW_COPY_AND_ASSIGN(SharedMemory);
+};
+
+} // namespace gpu_plugin
+} // namespace o3d
+
+#endif // O3D_GPU_PLUGIN_SYSTEM_SERVICES_SHARED_MEMORY_H_

Powered by Google App Engine
This is Rietveld 408576698