summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authordspringer@chromium.org <dspringer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-05 21:37:00 +0000
committerdspringer@chromium.org <dspringer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-05 21:37:00 +0000
commit14710e220b1e6fb4db5661b0569f978d850a7be6 (patch)
tree16fbd38c33750147601521ad7199e3821f01f32c /webkit/plugins
parentabbd2f4b36da8c89e6f3002eb84f60064a6ff067 (diff)
downloadchromium_src-14710e220b1e6fb4db5661b0569f978d850a7be6.zip
chromium_src-14710e220b1e6fb4db5661b0569f978d850a7be6.tar.gz
chromium_src-14710e220b1e6fb4db5661b0569f978d850a7be6.tar.bz2
Add PPB_Memory_Dev. This is the first of a few CLs needed to pull MemAlloc and
MemFree from PPB_Core. BUG=80610 TEST=ui_tests Review URL: http://codereview.chromium.org/7300010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc4
-rw-r--r--webkit/plugins/ppapi/ppb_memory_impl.cc37
-rw-r--r--webkit/plugins/ppapi/ppb_memory_impl.h23
3 files changed, 64 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index bd7bf11..c9f98c6 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -31,6 +31,7 @@
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
#include "ppapi/c/dev/ppb_layer_compositor_dev.h"
+#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_opengles_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_surface_3d_dev.h"
@@ -89,6 +90,7 @@
#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
#include "webkit/plugins/ppapi/ppb_layer_compositor_impl.h"
+#include "webkit/plugins/ppapi/ppb_memory_impl.h"
#include "webkit/plugins/ppapi/ppb_opengles_impl.h"
#include "webkit/plugins/ppapi/ppb_proxy_impl.h"
#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
@@ -292,6 +294,8 @@ const void* GetInterface(const char* name) {
return ::ppapi::thunk::GetPPB_Instance_0_5_Thunk();
if (strcmp(name, PPB_INSTANCE_PRIVATE_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Instance_Private_Thunk();
+ if (strcmp(name, PPB_MEMORY_DEV_INTERFACE) == 0)
+ return PPB_Memory_Impl::GetInterface();
if (strcmp(name, PPB_MESSAGING_INTERFACE) == 0)
return PluginInstance::GetMessagingInterface();
if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0)
diff --git a/webkit/plugins/ppapi/ppb_memory_impl.cc b/webkit/plugins/ppapi/ppb_memory_impl.cc
new file mode 100644
index 0000000..a298d44
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_memory_impl.cc
@@ -0,0 +1,37 @@
+// Copyright (c) 2011 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.
+
+#include "webkit/plugins/ppapi/ppb_memory_impl.h"
+
+#include <stdlib.h>
+#include "ppapi/c/dev/ppb_memory_dev.h"
+
+namespace webkit {
+namespace ppapi {
+
+namespace {
+
+void* MemAlloc(uint32_t num_bytes) {
+ return malloc(num_bytes);
+}
+
+void MemFree(void* ptr) {
+ free(ptr);
+}
+
+const PPB_Memory_Dev ppb_memory = {
+ &MemAlloc,
+ &MemFree
+};
+
+} // namespace
+
+// static
+const struct PPB_Memory_Dev* PPB_Memory_Impl::GetInterface() {
+ return &ppb_memory;
+}
+
+} // namespace ppapi
+} // namespace webkit
+
diff --git a/webkit/plugins/ppapi/ppb_memory_impl.h b/webkit/plugins/ppapi/ppb_memory_impl.h
new file mode 100644
index 0000000..f07c055
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_memory_impl.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_PPB_MEMORY_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_MEMORY_IMPL_H_
+
+struct PPB_Memory_Dev;
+
+namespace webkit {
+namespace ppapi {
+
+class PPB_Memory_Impl {
+ public:
+ // Returns a pointer to the interface implementing PPB_Memory_Dev that is
+ // exposed to the plugin.
+ static const PPB_Memory_Dev* GetInterface();
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_MEMORY_IMPL_H_