Index: content/common/gpu/client/command_buffer_proxy_impl.h |
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h |
index 2f0ed90e17f9a923e5dc67323485f684944967b3..0d7988f3cea07b4aed8c76029d9290c961e18917 100644 |
--- a/content/common/gpu/client/command_buffer_proxy_impl.h |
+++ b/content/common/gpu/client/command_buffer_proxy_impl.h |
@@ -20,16 +20,14 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/observer_list.h" |
+#include "content/common/gpu/client/ipc/command_buffer_ipc_transport.h" |
#include "gpu/command_buffer/client/gpu_control.h" |
#include "gpu/command_buffer/common/command_buffer.h" |
#include "gpu/command_buffer/common/command_buffer_shared.h" |
#include "gpu/command_buffer/common/gpu_memory_allocation.h" |
-#include "ipc/ipc_listener.h" |
#include "ui/events/latency_info.h" |
#include "ui/gfx/swap_result.h" |
-struct GPUCommandBufferConsoleMessage; |
- |
namespace base { |
class SharedMemory; |
} |
@@ -45,14 +43,16 @@ class VideoEncodeAccelerator; |
} |
namespace content { |
+ |
class GpuChannelHost; |
+struct CommandBufferConsoleMessage; |
// Client side proxy that forwards messages synchronously to a |
// CommandBufferStub. |
class CommandBufferProxyImpl |
: public gpu::CommandBuffer, |
public gpu::GpuControl, |
- public IPC::Listener, |
+ public CommandBufferIPCTransport::Client, |
public base::SupportsWeakPtr<CommandBufferProxyImpl> { |
public: |
class DeletionObserver { |
@@ -68,10 +68,18 @@ class CommandBufferProxyImpl |
const std::string& msg, int id)> GpuConsoleMessageCallback; |
CommandBufferProxyImpl(GpuChannelHost* channel, |
- int32_t route_id, |
+ scoped_ptr<CommandBufferIPCTransport> transport, |
int32_t stream_id); |
~CommandBufferProxyImpl() override; |
+ // TODO(fsamuel): It's a little unfortunate that we have to expose this. Let's |
+ // see if there's a way to hide this. |
+ const CommandBufferIPCTransport* transport() const { |
+ return transport_.get(); |
+ } |
+ |
+ CommandBufferIPCTransport* transport() { return transport_.get(); } |
+ |
// Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and |
// returns it as an owned pointer to a media::VideoDecodeAccelerator. Returns |
// NULL on failure to create the GpuVideoDecodeAcceleratorHost. |
@@ -88,10 +96,6 @@ class CommandBufferProxyImpl |
// is notified of an error later, after Initialize(); |
scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncoder(); |
- // IPC::Listener implementation: |
- bool OnMessageReceived(const IPC::Message& message) override; |
- void OnChannelError() override; |
- |
// CommandBuffer implementation: |
bool Initialize() override; |
State GetLastState() override; |
@@ -160,8 +164,6 @@ class CommandBufferProxyImpl |
// CommandBufferProxyImpl implementation. |
gpu::error::Error GetLastError() override; |
- int32_t route_id() const { return route_id_; } |
- |
int32_t stream_id() const { return stream_id_; } |
GpuChannelHost* channel() const { return channel_; } |
@@ -180,21 +182,19 @@ class CommandBufferProxyImpl |
lock_->AssertAcquired(); |
} |
- // Send an IPC message over the GPU channel. This is private to fully |
- // encapsulate the channel; all callers of this function must explicitly |
- // verify that the context has not been lost. |
- bool Send(IPC::Message* msg); |
- |
- // Message handlers: |
- void OnUpdateState(const gpu::CommandBuffer::State& state); |
+ // CommandBufferIPCTransport::Client implementation. |
+ void OnChannelError() override; |
+ void OnConsoleMessage(const CommandBufferConsoleMessage& message) override; |
void OnDestroyed(gpu::error::ContextLostReason reason, |
- gpu::error::Error error); |
- void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
- void OnSignalAck(uint32_t id); |
+ gpu::error::Error error) override; |
+ void OnDidHandleMessage() override; |
+ void OnSignalAck(uint32_t id) override; |
void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
- gfx::SwapResult result); |
+ gfx::SwapResult result) override; |
+ void OnUpdateState(const gpu::CommandBuffer::State& state) override; |
void OnUpdateVSyncParameters(base::TimeTicks timebase, |
- base::TimeDelta interval); |
+ base::TimeDelta interval) override; |
+ void OnWillHandleMessage() override; |
// Try to read an updated copy of the state from shared memory. |
void TryUpdateState(); |
@@ -229,8 +229,7 @@ class CommandBufferProxyImpl |
// |*this| is owned by |*channel_| and so is always outlived by it, so using a |
// raw pointer is ok. |
GpuChannelHost* channel_; |
- const uint64_t command_buffer_id_; |
- const int32_t route_id_; |
+ scoped_ptr<CommandBufferIPCTransport> transport_; |
const int32_t stream_id_; |
uint32_t flush_count_; |
int32_t last_put_offset_; |