| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 CommandBufferProxy(GpuChannelHost* channel, int route_id); | 36 CommandBufferProxy(GpuChannelHost* channel, int route_id); |
| 37 virtual ~CommandBufferProxy(); | 37 virtual ~CommandBufferProxy(); |
| 38 | 38 |
| 39 // IPC::Channel::Listener implementation: | 39 // IPC::Channel::Listener implementation: |
| 40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 41 virtual void OnChannelError() OVERRIDE; | 41 virtual void OnChannelError() OVERRIDE; |
| 42 | 42 |
| 43 int route_id() const { return route_id_; } | 43 int route_id() const { return route_id_; } |
| 44 | 44 |
| 45 // CommandBuffer implementation: | 45 // CommandBuffer implementation: |
| 46 virtual bool Initialize(int32 size) OVERRIDE; | 46 virtual bool Initialize() OVERRIDE; |
| 47 virtual bool Initialize(base::SharedMemory* buffer, int32 size) OVERRIDE; | |
| 48 virtual gpu::Buffer GetRingBuffer() OVERRIDE; | |
| 49 virtual State GetState() OVERRIDE; | 47 virtual State GetState() OVERRIDE; |
| 50 virtual State GetLastState() OVERRIDE; | 48 virtual State GetLastState() OVERRIDE; |
| 51 virtual void Flush(int32 put_offset) OVERRIDE; | 49 virtual void Flush(int32 put_offset) OVERRIDE; |
| 52 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; | 50 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; |
| 51 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; |
| 53 virtual void SetGetOffset(int32 get_offset) OVERRIDE; | 52 virtual void SetGetOffset(int32 get_offset) OVERRIDE; |
| 54 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE; | 53 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE; |
| 55 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | 54 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
| 56 size_t size, | 55 size_t size, |
| 57 int32 id_request) OVERRIDE; | 56 int32 id_request) OVERRIDE; |
| 58 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; | 57 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; |
| 59 virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE; | 58 virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE; |
| 60 virtual void SetToken(int32 token) OVERRIDE; | 59 virtual void SetToken(int32 token) OVERRIDE; |
| 61 virtual void SetParseError(gpu::error::Error error) OVERRIDE; | 60 virtual void SetParseError(gpu::error::Error error) OVERRIDE; |
| 62 virtual void SetContextLostReason( | 61 virtual void SetContextLostReason( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // encapsulate the channel; all callers of this function must explicitly | 96 // encapsulate the channel; all callers of this function must explicitly |
| 98 // verify that the context has not been lost. | 97 // verify that the context has not been lost. |
| 99 bool Send(IPC::Message* msg); | 98 bool Send(IPC::Message* msg); |
| 100 | 99 |
| 101 // Message handlers: | 100 // Message handlers: |
| 102 void OnUpdateState(const gpu::CommandBuffer::State& state); | 101 void OnUpdateState(const gpu::CommandBuffer::State& state); |
| 103 void OnNotifyRepaint(); | 102 void OnNotifyRepaint(); |
| 104 void OnDestroyed(gpu::error::ContextLostReason reason); | 103 void OnDestroyed(gpu::error::ContextLostReason reason); |
| 105 void OnEchoAck(); | 104 void OnEchoAck(); |
| 106 | 105 |
| 107 // As with the service, the client takes ownership of the ring buffer. | |
| 108 int32 num_entries_; | |
| 109 scoped_ptr<base::SharedMemory> ring_buffer_; | |
| 110 | |
| 111 // Local cache of id to transfer buffer mapping. | 106 // Local cache of id to transfer buffer mapping. |
| 112 typedef std::map<int32, gpu::Buffer> TransferBufferMap; | 107 typedef std::map<int32, gpu::Buffer> TransferBufferMap; |
| 113 TransferBufferMap transfer_buffers_; | 108 TransferBufferMap transfer_buffers_; |
| 114 | 109 |
| 115 // Zero or more video decoder hosts owned by this proxy, keyed by their | 110 // Zero or more video decoder hosts owned by this proxy, keyed by their |
| 116 // decoder_route_id. | 111 // decoder_route_id. |
| 117 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; | 112 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; |
| 118 Decoders video_decoder_hosts_; | 113 Decoders video_decoder_hosts_; |
| 119 | 114 |
| 120 // The last cached state received from the service. | 115 // The last cached state received from the service. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 132 base::Closure notify_repaint_task_; | 127 base::Closure notify_repaint_task_; |
| 133 | 128 |
| 134 base::Closure channel_error_callback_; | 129 base::Closure channel_error_callback_; |
| 135 | 130 |
| 136 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); | 131 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); |
| 137 }; | 132 }; |
| 138 | 133 |
| 139 #endif // ENABLE_GPU | 134 #endif // ENABLE_GPU |
| 140 | 135 |
| 141 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 136 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
| OLD | NEW |