summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_buffer_proxy.cc
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 20:37:04 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 20:37:04 +0000
commitc77a8dd4b83d07233202f99ce7951e7f002ebec7 (patch)
tree3f7aa1c79cca700e5f1d96a833c0cb474b8b285c /ppapi/proxy/ppb_buffer_proxy.cc
parent358be972e7edb780004c66be2b8b343beb755b00 (diff)
downloadchromium_src-c77a8dd4b83d07233202f99ce7951e7f002ebec7.zip
chromium_src-c77a8dd4b83d07233202f99ce7951e7f002ebec7.tar.gz
chromium_src-c77a8dd4b83d07233202f99ce7951e7f002ebec7.tar.bz2
Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it with a list of macros. When files want to know which Pepper interface names and structs there are, they define what they want to do with the macros, and then include the relevant files for the classes of interfaces they want (stable, private, dev).
This does not convert all the dev interfaces. I just did a few to keep the patch smaller. So there is still a lot of manual registration. This fixes the previous design problem where we assumed one *_Proxy object == one interface. We have been hacking around this lately with duplicate GetInfo calls, but this doesn't work for PPP interfaces. Now, a _Proxy object is just there to help keep things organized. One proxy can handle zero, one, or many interfaces, and this mapping is controlled by just one line in the interfaces file. So for example, to add a new function to a new version of an interface with backward compatibility, you would add that function to the _api.h file, and write a thunk for the new interface. Then you only need to add one line to the interfaces_ppb_public_stable.h file and that will be hooked up with the proxy and the implementation. This removes some _proxy objects/files that were used only to declare that the interfaces existed, since they're no longer necessary. I folded Console into the Instance API which removed a bunch of code. I removed FileChooser 0.4. I think everybody has converted to the new one, and I think parts of it weren't even hooked up properly anymore. Review URL: http://codereview.chromium.org/7740038 TBR=brettw@chromium.org Review URL: http://codereview.chromium.org/7844018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_buffer_proxy.cc')
-rw-r--r--ppapi/proxy/ppb_buffer_proxy.cc36
1 files changed, 26 insertions, 10 deletions
diff --git a/ppapi/proxy/ppb_buffer_proxy.cc b/ppapi/proxy/ppb_buffer_proxy.cc
index 957108a..d9092fe 100644
--- a/ppapi/proxy/ppb_buffer_proxy.cc
+++ b/ppapi/proxy/ppb_buffer_proxy.cc
@@ -17,12 +17,20 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_buffer_trusted_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace proxy {
+namespace {
+
+InterfaceProxy* CreateBufferProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Buffer_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
Buffer::Buffer(const HostResource& resource,
const base::SharedMemoryHandle& shm_handle,
uint32_t size)
@@ -61,14 +69,27 @@ void Buffer::Unmap() {
shm_.Unmap();
}
-PPB_Buffer_Proxy::PPB_Buffer_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_Buffer_Proxy::PPB_Buffer_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Buffer_Proxy::~PPB_Buffer_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Buffer_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_Buffer_Thunk(),
+ PPB_BUFFER_DEV_INTERFACE,
+ INTERFACE_ID_PPB_BUFFER,
+ false,
+ &CreateBufferProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_Buffer_Proxy::CreateProxyResource(PP_Instance instance,
uint32_t size) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
@@ -114,15 +135,10 @@ void PPB_Buffer_Proxy::OnMsgCreate(
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher)
return;
-
- thunk::EnterResourceCreation enter(instance);
- if (enter.failed())
- return;
- PP_Resource local_buffer_resource = enter.functions()->CreateBuffer(instance,
- size);
+ PP_Resource local_buffer_resource =
+ ppb_buffer_target()->Create(instance, size);
if (local_buffer_resource == 0)
return;
-
thunk::EnterResourceNoLock<thunk::PPB_BufferTrusted_API> trusted_buffer(
local_buffer_resource, false);
if (trusted_buffer.failed())