summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.cc32
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.h7
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.cc18
3 files changed, 35 insertions, 22 deletions
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc
index 175b8de..ad80a27 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -129,22 +129,26 @@ void PpapiCommandBufferProxy::SetGetOffset(int32 get_offset) {
NOTREACHED();
}
-gpu::Buffer PpapiCommandBufferProxy::CreateTransferBuffer(size_t size,
- int32* id) {
- *id = -1;
-
- if (last_state_.error != gpu::error::kNoError)
- return gpu::Buffer();
-
- if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer(
- ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id))) {
- return gpu::Buffer();
+int32 PpapiCommandBufferProxy::CreateTransferBuffer(
+ size_t size,
+ int32 id_request) {
+ if (last_state_.error == gpu::error::kNoError) {
+ int32 id;
+ if (Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer(
+ ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, &id))) {
+ return id;
+ }
}
+ return -1;
+}
- if ((*id) <= 0)
- return gpu::Buffer();
-
- return GetTransferBuffer(*id);
+int32 PpapiCommandBufferProxy::RegisterTransferBuffer(
+ base::SharedMemory* shared_memory,
+ size_t size,
+ int32 id_request) {
+ // Not implemented in proxy.
+ NOTREACHED();
+ return -1;
}
void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) {
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h
index d1aac55..716d3f3 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -44,9 +44,12 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public CommandBufferProxy {
virtual State FlushSync(int32 put_offset, int32 last_known_get);
virtual void SetGetBuffer(int32 transfer_buffer_id);
virtual void SetGetOffset(int32 get_offset);
- virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id);
+ virtual int32 CreateTransferBuffer(size_t size, int32 id_request);
+ virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
+ size_t size,
+ int32 id_request);
virtual void DestroyTransferBuffer(int32 id);
- virtual gpu::Buffer GetTransferBuffer(int32 id);
+ virtual gpu::Buffer GetTransferBuffer(int32 handle);
virtual void SetToken(int32 token);
virtual void SetParseError(gpu::error::Error error);
virtual void SetContextLostReason(gpu::error::ContextLostReason reason);
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 03d1ca2..cef181a 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -146,18 +146,24 @@ class Graphics3D::LockingCommandBuffer : public gpu::CommandBuffer {
MaybeLock lock(need_to_lock_);
gpu_command_buffer_->SetGetOffset(get_offset);
}
- virtual gpu::Buffer CreateTransferBuffer(size_t size,
- int32* id) OVERRIDE {
+ virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE {
MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->CreateTransferBuffer(size, id);
+ return gpu_command_buffer_->CreateTransferBuffer(size, id_request);
+ }
+ virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
+ size_t size,
+ int32 id_request) OVERRIDE {
+ MaybeLock lock(need_to_lock_);
+ return gpu_command_buffer_->RegisterTransferBuffer(shared_memory, size,
+ id_request);
}
virtual void DestroyTransferBuffer(int32 id) OVERRIDE {
MaybeLock lock(need_to_lock_);
gpu_command_buffer_->DestroyTransferBuffer(id);
}
- virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE {
+ virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE {
MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->GetTransferBuffer(id);
+ return gpu_command_buffer_->GetTransferBuffer(handle);
}
virtual void SetToken(int32 token) OVERRIDE {
MaybeLock lock(need_to_lock_);
@@ -449,7 +455,7 @@ void PPB_Graphics3D_Proxy::OnMsgCreateTransferBuffer(
if (enter.succeeded())
*id = enter.object()->CreateTransferBuffer(size);
else
- *id = -1;
+ *id = 0;
}
void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer(