| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
| 6 #define CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 6 #define CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <queue> | 12 #include <queue> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/task.h" | 18 #include "base/task.h" |
| 19 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" | 19 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" |
| 20 #include "gpu/command_buffer/common/command_buffer.h" | 20 #include "gpu/command_buffer/common/command_buffer.h" |
| 21 #include "ipc/ipc_channel.h" | 21 #include "ipc/ipc_channel.h" |
| 22 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
| 23 | 23 |
| 24 class GpuChannelHost; | 24 class GpuChannelHost; |
| 25 struct GPUCommandBufferConsoleMessage; |
| 25 | 26 |
| 26 namespace base { | 27 namespace base { |
| 27 class SharedMemory; | 28 class SharedMemory; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // Client side proxy that forwards messages synchronously to a | 31 // Client side proxy that forwards messages synchronously to a |
| 31 // CommandBufferStub. | 32 // CommandBufferStub. |
| 32 class CommandBufferProxy : public gpu::CommandBuffer, | 33 class CommandBufferProxy : public gpu::CommandBuffer, |
| 33 public IPC::Channel::Listener, | 34 public IPC::Channel::Listener, |
| 34 public base::SupportsWeakPtr<CommandBufferProxy> { | 35 public base::SupportsWeakPtr<CommandBufferProxy> { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Send an IPC message over the GPU channel. This is private to fully | 96 // Send an IPC message over the GPU channel. This is private to fully |
| 96 // encapsulate the channel; all callers of this function must explicitly | 97 // encapsulate the channel; all callers of this function must explicitly |
| 97 // verify that the context has not been lost. | 98 // verify that the context has not been lost. |
| 98 bool Send(IPC::Message* msg); | 99 bool Send(IPC::Message* msg); |
| 99 | 100 |
| 100 // Message handlers: | 101 // Message handlers: |
| 101 void OnUpdateState(const gpu::CommandBuffer::State& state); | 102 void OnUpdateState(const gpu::CommandBuffer::State& state); |
| 102 void OnNotifyRepaint(); | 103 void OnNotifyRepaint(); |
| 103 void OnDestroyed(gpu::error::ContextLostReason reason); | 104 void OnDestroyed(gpu::error::ContextLostReason reason); |
| 104 void OnEchoAck(); | 105 void OnEchoAck(); |
| 106 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
| 105 | 107 |
| 106 // Local cache of id to transfer buffer mapping. | 108 // Local cache of id to transfer buffer mapping. |
| 107 typedef std::map<int32, gpu::Buffer> TransferBufferMap; | 109 typedef std::map<int32, gpu::Buffer> TransferBufferMap; |
| 108 TransferBufferMap transfer_buffers_; | 110 TransferBufferMap transfer_buffers_; |
| 109 | 111 |
| 110 // Zero or more video decoder hosts owned by this proxy, keyed by their | 112 // Zero or more video decoder hosts owned by this proxy, keyed by their |
| 111 // decoder_route_id. | 113 // decoder_route_id. |
| 112 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; | 114 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; |
| 113 Decoders video_decoder_hosts_; | 115 Decoders video_decoder_hosts_; |
| 114 | 116 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 127 base::Closure notify_repaint_task_; | 129 base::Closure notify_repaint_task_; |
| 128 | 130 |
| 129 base::Closure channel_error_callback_; | 131 base::Closure channel_error_callback_; |
| 130 | 132 |
| 131 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); | 133 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 #endif // ENABLE_GPU | 136 #endif // ENABLE_GPU |
| 135 | 137 |
| 136 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 138 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
| OLD | NEW |