Chromium Code Reviews| Index: ppapi/proxy/ppapi_command_buffer_proxy.cc |
| diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc |
| index 4d140f2a8ea912a12eb8019e88b3a39cb7d1e498..03e8e73bb78c42427ab289737ff71b6da6cc14f6 100644 |
| --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc |
| +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc |
| @@ -106,11 +106,6 @@ void PpapiCommandBufferProxy::SetGetBuffer(int32 transfer_buffer_id) { |
| } |
| } |
| -void PpapiCommandBufferProxy::SetGetOffset(int32 get_offset) { |
| - // Not implemented in proxy. |
| - NOTREACHED(); |
| -} |
| - |
| scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::CreateTransferBuffer( |
| size_t size, |
| int32* id) { |
| @@ -119,66 +114,18 @@ scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::CreateTransferBuffer( |
| if (last_state_.error != gpu::error::kNoError) |
| return NULL; |
| - if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( |
| - ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id))) { |
| - return NULL; |
| - } |
| - |
| - if ((*id) <= 0) |
| - return NULL; |
|
no sievers
2014/03/28 21:01:03
Ah, that's why.
|
| - |
| - return GetTransferBuffer(*id); |
| -} |
| - |
| -void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { |
| - if (last_state_.error != gpu::error::kNoError) |
| - return; |
| - |
| - // Remove the transfer buffer from the client side4 cache. |
| - TransferBufferMap::iterator it = transfer_buffers_.find(id); |
| - |
| - // Remove reference to buffer, allowing the shared memory object to be |
| - // deleted, closing the handle in the process. |
| - if (it != transfer_buffers_.end()) |
| - transfer_buffers_.erase(it); |
| - |
| - Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer( |
| - ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); |
| -} |
| - |
| -void PpapiCommandBufferProxy::Echo(const base::Closure& callback) { |
| - NOTREACHED(); |
| -} |
| - |
| -uint32 PpapiCommandBufferProxy::CreateStreamTexture(uint32 texture_id) { |
| - NOTREACHED(); |
| - return 0; |
| -} |
| - |
| -scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::GetTransferBuffer( |
| - int32 id) { |
| - if (last_state_.error != gpu::error::kNoError) |
| - return NULL; |
| - |
| - // Check local cache to see if there is already a client side shared memory |
| - // object for this id. |
| - TransferBufferMap::iterator it = transfer_buffers_.find(id); |
| - if (it != transfer_buffers_.end()) { |
| - return it->second; |
| - } |
| - |
| // Assuming we are in the renderer process, the service is responsible for |
| // duplicating the handle. This might not be true for NaCl. |
| ppapi::proxy::SerializedHandle handle( |
| ppapi::proxy::SerializedHandle::SHARED_MEMORY); |
| - if (!Send(new PpapiHostMsg_PPBGraphics3D_GetTransferBuffer( |
| - ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id, &handle))) { |
| + if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( |
| + ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id, &handle))) { |
| return NULL; |
| } |
| - if (!handle.is_shmem()) |
| + |
| + if ((*id) <= 0 || !handle.is_shmem()) |
|
bbudge
2014/03/28 03:45:47
Isn't id an int here?
piman
2014/03/28 04:47:55
id is a pointer to a signed int, yes?
PpapiHostMsg
bbudge
2014/03/28 05:43:30
I got confused by the function signature of GetTra
bbudge
2014/03/28 05:51:31
nit: the parens aren't needed here, are they?
piman
2014/03/28 05:54:02
Probably not, I can remove them.
piman
2014/03/28 23:23:40
Done.
|
| return NULL; |
| - // Cache the transfer buffer shared memory object client side. |
| scoped_ptr<base::SharedMemory> shared_memory( |
| new base::SharedMemory(handle.shmem(), false)); |
| @@ -191,21 +138,24 @@ scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::GetTransferBuffer( |
| scoped_refptr<gpu::Buffer> buffer = |
| new gpu::Buffer(shared_memory.Pass(), handle.size()); |
| - transfer_buffers_[id] = buffer; |
| return buffer; |
| } |
| -void PpapiCommandBufferProxy::SetToken(int32 token) { |
| - NOTREACHED(); |
| +void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { |
| + if (last_state_.error != gpu::error::kNoError) |
| + return; |
| + |
| + Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer( |
| + ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); |
| } |
| -void PpapiCommandBufferProxy::SetParseError(gpu::error::Error error) { |
| +void PpapiCommandBufferProxy::Echo(const base::Closure& callback) { |
| NOTREACHED(); |
| } |
| -void PpapiCommandBufferProxy::SetContextLostReason( |
| - gpu::error::ContextLostReason reason) { |
| +uint32 PpapiCommandBufferProxy::CreateStreamTexture(uint32 texture_id) { |
| NOTREACHED(); |
| + return 0; |
| } |
| uint32 PpapiCommandBufferProxy::InsertSyncPoint() { |