summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-01 09:06:43 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-01 09:06:43 +0000
commit046fa1ac81455233e53b629f2160ca9eab08e741 (patch)
treeb9376b2320f2fd801a71580f9325bf31ee950359 /mojo
parent966a3c6eda39c487da641e1b5e4ccba06802e3ba (diff)
downloadchromium_src-046fa1ac81455233e53b629f2160ca9eab08e741.zip
chromium_src-046fa1ac81455233e53b629f2160ca9eab08e741.tar.gz
chromium_src-046fa1ac81455233e53b629f2160ca9eab08e741.tar.bz2
Remove CommandBuffer::GetTransferBuffer.
The only time we call GetTransferBuffer is on Pepper, right after CreateTransferBuffer, so combine the two. This lets us dramatically remove all the maintenance burden (maps) and extra IPCs. Also separate service-only calls out of CommandBuffer, into CommandBufferServiceBase BUG=None Review URL: https://codereview.chromium.org/215803002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/examples/pepper_container_app/graphics_3d_resource.cc13
-rw-r--r--mojo/examples/pepper_container_app/graphics_3d_resource.h6
-rw-r--r--mojo/gles2/command_buffer_client_impl.cc37
-rw-r--r--mojo/gles2/command_buffer_client_impl.h9
-rw-r--r--mojo/mojo_examples.gypi1
5 files changed, 7 insertions, 59 deletions
diff --git a/mojo/examples/pepper_container_app/graphics_3d_resource.cc b/mojo/examples/pepper_container_app/graphics_3d_resource.cc
index 6f05359..b41776f 100644
--- a/mojo/examples/pepper_container_app/graphics_3d_resource.cc
+++ b/mojo/examples/pepper_container_app/graphics_3d_resource.cc
@@ -91,9 +91,11 @@ gpu::CommandBuffer::State Graphics3DResource::GetState() {
return GetErrorState();
}
-int32_t Graphics3DResource::CreateTransferBuffer(uint32_t size) {
+scoped_refptr<gpu::Buffer> Graphics3DResource::CreateTransferBuffer(
+ uint32_t size,
+ int32* id) {
NOTIMPLEMENTED();
- return PP_FALSE;
+ return NULL;
}
PP_Bool Graphics3DResource::DestroyTransferBuffer(int32_t id) {
@@ -101,13 +103,6 @@ PP_Bool Graphics3DResource::DestroyTransferBuffer(int32_t id) {
return PP_FALSE;
}
-PP_Bool Graphics3DResource::GetTransferBuffer(int32_t id,
- int* shm_handle,
- uint32_t* shm_size) {
- NOTIMPLEMENTED();
- return PP_FALSE;
-}
-
PP_Bool Graphics3DResource::Flush(int32_t put_offset) {
NOTIMPLEMENTED();
return PP_FALSE;
diff --git a/mojo/examples/pepper_container_app/graphics_3d_resource.h b/mojo/examples/pepper_container_app/graphics_3d_resource.h
index 68d70e4..9c5f256 100644
--- a/mojo/examples/pepper_container_app/graphics_3d_resource.h
+++ b/mojo/examples/pepper_container_app/graphics_3d_resource.h
@@ -36,11 +36,9 @@ class Graphics3DResource : public ppapi::Resource,
virtual int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) OVERRIDE;
virtual PP_Bool SetGetBuffer(int32_t shm_id) OVERRIDE;
virtual gpu::CommandBuffer::State GetState() OVERRIDE;
- virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
+ virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size,
+ int32* id) OVERRIDE;
virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
- virtual PP_Bool GetTransferBuffer(int32_t id,
- int* shm_handle,
- uint32_t* shm_size) OVERRIDE;
virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start,
int32_t end) OVERRIDE;
diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc
index 16e7193..8c7e6c0 100644
--- a/mojo/gles2/command_buffer_client_impl.cc
+++ b/mojo/gles2/command_buffer_client_impl.cc
@@ -103,11 +103,6 @@ void CommandBufferClientImpl::SetGetBuffer(int32 shm_id) {
last_put_offset_ = -1;
}
-void CommandBufferClientImpl::SetGetOffset(int32 get_offset) {
- // Not implemented in proxy.
- NOTREACHED();
-}
-
scoped_refptr<gpu::Buffer> CommandBufferClientImpl::CreateTransferBuffer(
size_t size,
int32* id) {
@@ -124,7 +119,6 @@ scoped_refptr<gpu::Buffer> CommandBufferClientImpl::CreateTransferBuffer(
return NULL;
*id = ++next_transfer_buffer_id_;
- DCHECK(transfer_buffers_.find(*id) == transfer_buffers_.end());
AllocationScope scope;
command_buffer_->RegisterTransferBuffer(
@@ -132,44 +126,13 @@ scoped_refptr<gpu::Buffer> CommandBufferClientImpl::CreateTransferBuffer(
scoped_refptr<gpu::Buffer> buffer =
new gpu::Buffer(shared_memory.Pass(), size);
- transfer_buffers_[*id] = buffer;
-
return buffer;
}
void CommandBufferClientImpl::DestroyTransferBuffer(int32 id) {
- TransferBufferMap::iterator it = transfer_buffers_.find(id);
- if (it != transfer_buffers_.end())
- transfer_buffers_.erase(it);
command_buffer_->DestroyTransferBuffer(id);
}
-scoped_refptr<gpu::Buffer> CommandBufferClientImpl::GetTransferBuffer(
- int32 id) {
- TransferBufferMap::iterator it = transfer_buffers_.find(id);
- if (it != transfer_buffers_.end()) {
- return it->second;
- } else {
- return NULL;
- }
-}
-
-void CommandBufferClientImpl::SetToken(int32 token) {
- // Not implemented in proxy.
- NOTREACHED();
-}
-
-void CommandBufferClientImpl::SetParseError(gpu::error::Error error) {
- // Not implemented in proxy.
- NOTREACHED();
-}
-
-void CommandBufferClientImpl::SetContextLostReason(
- gpu::error::ContextLostReason reason) {
- // Not implemented in proxy.
- NOTREACHED();
-}
-
gpu::Capabilities CommandBufferClientImpl::GetCapabilities() {
// TODO(piman)
NOTIMPLEMENTED();
diff --git a/mojo/gles2/command_buffer_client_impl.h b/mojo/gles2/command_buffer_client_impl.h
index 2934274..d6fdb36 100644
--- a/mojo/gles2/command_buffer_client_impl.h
+++ b/mojo/gles2/command_buffer_client_impl.h
@@ -56,15 +56,9 @@ class CommandBufferClientImpl : public CommandBufferClient,
virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE;
virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE;
virtual void SetGetBuffer(int32 shm_id) OVERRIDE;
- virtual void SetGetOffset(int32 get_offset) OVERRIDE;
virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size,
int32* id) OVERRIDE;
virtual void DestroyTransferBuffer(int32 id) OVERRIDE;
- virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) OVERRIDE;
- virtual void SetToken(int32 token) OVERRIDE;
- virtual void SetParseError(gpu::error::Error error) OVERRIDE;
- virtual void SetContextLostReason(gpu::error::ContextLostReason reason)
- OVERRIDE;
// gpu::GpuControl implementation:
virtual gpu::Capabilities GetCapabilities() OVERRIDE;
@@ -88,8 +82,6 @@ class CommandBufferClientImpl : public CommandBufferClient,
void CancelAnimationFrames();
private:
- typedef std::map<int32, scoped_refptr<gpu::Buffer> > TransferBufferMap;
-
// CommandBufferClient implementation:
virtual void DidInitialize(bool success) OVERRIDE;
virtual void DidMakeProgress(const CommandBufferState& state) OVERRIDE;
@@ -115,7 +107,6 @@ class CommandBufferClientImpl : public CommandBufferClient,
State last_state_;
scoped_ptr<base::SharedMemory> shared_state_shm_;
- TransferBufferMap transfer_buffers_;
int32 last_put_offset_;
int32 next_transfer_buffer_id_;
diff --git a/mojo/mojo_examples.gypi b/mojo/mojo_examples.gypi
index 0731887..f83c4a9 100644
--- a/mojo/mojo_examples.gypi
+++ b/mojo/mojo_examples.gypi
@@ -86,6 +86,7 @@
'dependencies': [
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
+ '../gpu/gpu.gyp:command_buffer_common',
'../ppapi/ppapi.gyp:ppapi_c',
'../ppapi/ppapi_internal.gyp:ppapi_example_gles2_spinning_cube',
'mojo_environment_chromium',