Index: ppapi/proxy/ppb_context_3d_proxy.cc |
diff --git a/ppapi/proxy/ppb_context_3d_proxy.cc b/ppapi/proxy/ppb_context_3d_proxy.cc |
index dd8b030adcaa3f54ce569156bf04f3366333f532..d811daef203021eae2ebc9571d2f8bd5d047059d 100644 |
--- a/ppapi/proxy/ppb_context_3d_proxy.cc |
+++ b/ppapi/proxy/ppb_context_3d_proxy.cc |
@@ -77,13 +77,12 @@ class PepperCommandBuffer : public gpu::CommandBuffer { |
virtual ~PepperCommandBuffer(); |
// CommandBuffer implementation: |
- virtual bool Initialize(int32 size); |
- virtual bool Initialize(base::SharedMemory* buffer, int32 size); |
- virtual gpu::Buffer GetRingBuffer(); |
+ virtual bool Initialize(); |
virtual State GetState(); |
virtual State GetLastState(); |
virtual void Flush(int32 put_offset); |
virtual State FlushSync(int32 put_offset, int32 last_known_get); |
+ virtual void SetGetBuffer(int32 shm_id); |
virtual void SetGetOffset(int32 get_offset); |
virtual int32 CreateTransferBuffer(size_t size, int32 id_request); |
virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
@@ -132,41 +131,9 @@ PepperCommandBuffer::~PepperCommandBuffer() { |
} |
} |
-bool PepperCommandBuffer::Initialize(int32 size) { |
- DCHECK(!ring_buffer_.get()); |
- |
- // Initialize the service. Assuming we are sandboxed, the GPU |
- // process is responsible for duplicating the handle. This might not be true |
- // for NaCl. |
- base::SharedMemoryHandle handle; |
- if (Send(new PpapiHostMsg_PPBContext3D_Initialize( |
- API_ID_PPB_CONTEXT_3D, resource_, size, &handle)) && |
- base::SharedMemory::IsHandleValid(handle)) { |
- ring_buffer_.reset(new base::SharedMemory(handle, false)); |
- if (ring_buffer_->Map(size)) { |
- num_entries_ = size / sizeof(gpu::CommandBufferEntry); |
- return true; |
- } |
- |
- ring_buffer_.reset(); |
- } |
- |
- return false; |
-} |
- |
-bool PepperCommandBuffer::Initialize(base::SharedMemory* buffer, int32 size) { |
- // Not implemented in proxy. |
- NOTREACHED(); |
- return false; |
-} |
- |
-gpu::Buffer PepperCommandBuffer::GetRingBuffer() { |
- // Return locally cached ring buffer. |
- gpu::Buffer buffer; |
- buffer.ptr = ring_buffer_->memory(); |
- buffer.size = num_entries_ * sizeof(gpu::CommandBufferEntry); |
- buffer.shared_memory = ring_buffer_.get(); |
- return buffer; |
+bool PepperCommandBuffer::Initialize() { |
+ return Send(new PpapiHostMsg_PPBContext3D_Initialize( |
+ API_ID_PPB_CONTEXT_3D, resource_)); |
} |
gpu::CommandBuffer::State PepperCommandBuffer::GetState() { |
@@ -217,6 +184,13 @@ gpu::CommandBuffer::State PepperCommandBuffer::FlushSync( |
return last_state_; |
} |
+void PepperCommandBuffer::SetGetBuffer(int32 shm_id) { |
+ if (last_state_.error == gpu::error::kNoError) { |
+ Send(new PpapiHostMsg_PPBContext3D_SetGetBuffer( |
piman
2011/11/20 01:19:16
Note: I can see that this message is not handled,
|
+ API_ID_PPB_CONTEXT_3D, resource_, shm_id)); |
+ } |
+} |
+ |
void PepperCommandBuffer::SetGetOffset(int32 get_offset) { |
// Not implemented in proxy. |
NOTREACHED(); |
@@ -355,7 +329,7 @@ bool Context3D::CreateImplementation() { |
command_buffer_.reset(new PepperCommandBuffer(host_resource(), dispatcher)); |
- if (!command_buffer_->Initialize(kCommandBufferSize)) |
+ if (!command_buffer_->Initialize()) |
return false; |
helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); |
@@ -444,13 +418,12 @@ int32_t Context3D::GetBoundSurfaces(PP_Resource* draw, PP_Resource* read) { |
return PP_OK; |
} |
-PP_Bool Context3D::InitializeTrusted(int32_t size) { |
+PP_Bool Context3D::InitializeTrusted() { |
// Trusted interface not implemented in the proxy. |
return PP_FALSE; |
} |
-PP_Bool Context3D::GetRingBuffer(int* shm_handle, |
- uint32_t* shm_size) { |
+PP_Bool Context3D::SetGetBuffer(int32_t shm_id) { |
// Trusted interface not implemented in the proxy. |
return PP_FALSE; |
} |
@@ -614,22 +587,13 @@ void PPB_Context3D_Proxy::OnMsgBindSurfaces(const HostResource& context, |
} |
void PPB_Context3D_Proxy::OnMsgInitialize( |
- const HostResource& context, |
- int32 size, |
- base::SharedMemoryHandle* ring_buffer) { |
- *ring_buffer = base::SharedMemory::NULLHandle(); |
- EnterHostFromHostResource<PPB_Context3D_API> enter(context); |
+ const HostResource& context) { |
+ EnterHostFromHostResource<PPB_Context3D_API> enter(context); |
if (enter.failed()) |
return; |
- if (!enter.object()->InitializeTrusted(size)) |
- return; |
- |
- int shm_handle; |
- uint32_t shm_size; |
- if (!enter.object()->GetRingBuffer(&shm_handle, &shm_size)) |
+ if (!enter.object()->InitializeTrusted()) |
return; |
- *ring_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); |
} |
void PPB_Context3D_Proxy::OnMsgGetState(const HostResource& context, |