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() OVERRIDE; | 46 virtual bool Initialize(int32 size) OVERRIDE; |
| 47 virtual bool Initialize(base::SharedMemory* buffer, int32 size) OVERRIDE; |
| 48 virtual gpu::Buffer GetRingBuffer() OVERRIDE; |
47 virtual State GetState() OVERRIDE; | 49 virtual State GetState() OVERRIDE; |
48 virtual State GetLastState() OVERRIDE; | 50 virtual State GetLastState() OVERRIDE; |
49 virtual void Flush(int32 put_offset) OVERRIDE; | 51 virtual void Flush(int32 put_offset) OVERRIDE; |
50 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; | 52 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; |
51 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; | |
52 virtual void SetGetOffset(int32 get_offset) OVERRIDE; | 53 virtual void SetGetOffset(int32 get_offset) OVERRIDE; |
53 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE; | 54 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE; |
54 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | 55 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
55 size_t size, | 56 size_t size, |
56 int32 id_request) OVERRIDE; | 57 int32 id_request) OVERRIDE; |
57 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; | 58 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; |
58 virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE; | 59 virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE; |
59 virtual void SetToken(int32 token) OVERRIDE; | 60 virtual void SetToken(int32 token) OVERRIDE; |
60 virtual void SetParseError(gpu::error::Error error) OVERRIDE; | 61 virtual void SetParseError(gpu::error::Error error) OVERRIDE; |
61 virtual void SetContextLostReason( | 62 virtual void SetContextLostReason( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
105 | 106 |
| 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 |
106 // Local cache of id to transfer buffer mapping. | 111 // Local cache of id to transfer buffer mapping. |
107 typedef std::map<int32, gpu::Buffer> TransferBufferMap; | 112 typedef std::map<int32, gpu::Buffer> TransferBufferMap; |
108 TransferBufferMap transfer_buffers_; | 113 TransferBufferMap transfer_buffers_; |
109 | 114 |
110 // Zero or more video decoder hosts owned by this proxy, keyed by their | 115 // Zero or more video decoder hosts owned by this proxy, keyed by their |
111 // decoder_route_id. | 116 // decoder_route_id. |
112 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; | 117 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; |
113 Decoders video_decoder_hosts_; | 118 Decoders video_decoder_hosts_; |
114 | 119 |
115 // The last cached state received from the service. | 120 // The last cached state received from the service. |
(...skipping 11 matching lines...) Expand all Loading... |
127 base::Closure notify_repaint_task_; | 132 base::Closure notify_repaint_task_; |
128 | 133 |
129 base::Closure channel_error_callback_; | 134 base::Closure channel_error_callback_; |
130 | 135 |
131 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); | 136 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); |
132 }; | 137 }; |
133 | 138 |
134 #endif // ENABLE_GPU | 139 #endif // ENABLE_GPU |
135 | 140 |
136 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 141 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
OLD | NEW |