Chromium Code Reviews| Index: content/common/gpu/gpu_command_buffer_stub.h |
| diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h |
| index 8f4e84a0f092e32e70e6385c50471eb5f4bd7c9b..d10b6dacd686505705bcc448f15481902906b7a0 100644 |
| --- a/content/common/gpu/gpu_command_buffer_stub.h |
| +++ b/content/common/gpu/gpu_command_buffer_stub.h |
| @@ -13,6 +13,7 @@ |
| #include "base/id_map.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "content/common/content_export.h" |
| #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| #include "gpu/command_buffer/common/constants.h" |
| #include "gpu/command_buffer/service/command_buffer_service.h" |
| @@ -32,11 +33,40 @@ |
| #endif |
| class GpuChannel; |
| +class GpuMemoryAllocation; |
| class GpuWatchdog; |
| +// This Base class is used to expose methods of GpuCommandBufferStub used for |
| +// testability. |
| +class CONTENT_EXPORT GpuCommandBufferStubBase { |
| + public: |
| + struct CONTENT_EXPORT SurfaceState { |
| + int32 surface_id; |
| + bool visible; |
| + base::TimeTicks last_used_time; |
| + |
| + SurfaceState(int32 surface_id, |
| + bool visible, |
| + base::TimeTicks last_used_time); |
| + }; |
| + |
| + public: |
| + virtual ~GpuCommandBufferStubBase() {} |
| + |
| + // Null if this is an offscreen commandbuffer. |
| + virtual SurfaceState* surface_state() = 0; |
|
jonathan.backer
2012/02/01 19:43:17
Can the surface state be modified? maybe return a
mmocny
2012/02/01 20:44:19
It is modified: last_used_time and visibility are
jonathan.backer
2012/02/01 21:39:14
Inside the Stub, we can use surface_state_ to modi
mmocny
2012/02/01 22:31:08
Done.
|
| + |
| + // This stubs' surface_id should *not* be in the affected_surface_ids list. |
| + virtual const std::vector<int32>& affected_surface_ids() = 0; |
| + |
| + virtual void SendMemoryAllocationToProxy( |
| + const GpuMemoryAllocation& allocation) = 0; |
|
jonathan.backer
2012/02/01 19:43:17
Not used in this CL. Nix?
mmocny
2012/02/01 20:44:19
It is used by the Manage function. Even though it
|
| +}; |
| + |
| class GpuCommandBufferStub |
| : public IPC::Channel::Listener, |
| public IPC::Message::Sender, |
| + public GpuCommandBufferStubBase, |
| public base::SupportsWeakPtr<GpuCommandBufferStub> { |
| public: |
| GpuCommandBufferStub( |
| @@ -61,6 +91,17 @@ class GpuCommandBufferStub |
| // IPC::Message::Sender implementation: |
| virtual bool Send(IPC::Message* msg) OVERRIDE; |
| + // GpuCommandBufferStubBase implementation: |
| + virtual GpuCommandBufferStubBase::SurfaceState* surface_state() OVERRIDE; |
| + |
| + // The affected_surface_ids field refers to others stubs' surfaces. This |
| + // stubs' surface_id is found via surface state. |
| + virtual const std::vector<int32>& affected_surface_ids() OVERRIDE; |
|
jonathan.backer
2012/02/01 19:43:17
Chatted with mmocny offline. It appears that this
|
| + |
| + // Sends memory allocation limits to render process. |
| + virtual void SendMemoryAllocationToProxy( |
| + const GpuMemoryAllocation& allocation) OVERRIDE; |
| + |
| // Whether this command buffer can currently handle IPC messages. |
| bool IsScheduled(); |
| @@ -74,7 +115,7 @@ class GpuCommandBufferStub |
| gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
| // Identifies the target surface. |
| - int32 surface_id() const { return surface_id_; } |
| + int32 surface_id() const; |
|
jonathan.backer
2012/02/01 19:43:17
Why? Doesn't this prevent it from being inlined?
mmocny
2012/02/01 20:44:19
It may prevent it from being inlined (linkers can
jonathan.backer
2012/02/01 21:39:14
It's very trivial, IMHO.
mmocny
2012/02/01 22:31:08
Done.
|
| // Identifies the various GpuCommandBufferStubs in the GPU process belonging |
| // to the same renderer process. |
| @@ -141,9 +182,8 @@ class GpuCommandBufferStub |
| int32 route_id_; |
| bool software_; |
| uint32 last_flush_count_; |
| - |
| - // Identifies the window for the rendering results on the browser side. |
| - int32 surface_id_; |
| + scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_; |
| + std::vector<int32> affected_surface_ids_; |
| scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |