OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_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 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | 19 #include "content/common/gpu/client/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 "gpu/command_buffer/common/command_buffer_shared.h" | |
21 #include "ipc/ipc_channel.h" | 22 #include "ipc/ipc_channel.h" |
22 #include "ipc/ipc_message.h" | 23 #include "ipc/ipc_message.h" |
23 | 24 |
24 class GpuChannelHost; | 25 class GpuChannelHost; |
25 struct GPUCommandBufferConsoleMessage; | 26 struct GPUCommandBufferConsoleMessage; |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 class SharedMemory; | 29 class SharedMemory; |
29 } | 30 } |
30 | 31 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 // verify that the context has not been lost. | 110 // verify that the context has not been lost. |
110 bool Send(IPC::Message* msg); | 111 bool Send(IPC::Message* msg); |
111 | 112 |
112 // Message handlers: | 113 // Message handlers: |
113 void OnUpdateState(const gpu::CommandBuffer::State& state); | 114 void OnUpdateState(const gpu::CommandBuffer::State& state); |
114 void OnNotifyRepaint(); | 115 void OnNotifyRepaint(); |
115 void OnDestroyed(gpu::error::ContextLostReason reason); | 116 void OnDestroyed(gpu::error::ContextLostReason reason); |
116 void OnEchoAck(); | 117 void OnEchoAck(); |
117 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 118 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
118 | 119 |
120 // Try to read an updated copy of the state from shared memory. | |
121 void TryUpdateState(); | |
122 | |
119 // Local cache of id to transfer buffer mapping. | 123 // Local cache of id to transfer buffer mapping. |
120 typedef std::map<int32, gpu::Buffer> TransferBufferMap; | 124 typedef std::map<int32, gpu::Buffer> TransferBufferMap; |
121 TransferBufferMap transfer_buffers_; | 125 TransferBufferMap transfer_buffers_; |
122 | 126 |
123 // Zero or more video decoder hosts owned by this proxy, keyed by their | 127 // Zero or more video decoder hosts owned by this proxy, keyed by their |
124 // decoder_route_id. | 128 // decoder_route_id. |
125 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; | 129 typedef std::map<int, scoped_refptr<GpuVideoDecodeAcceleratorHost> > Decoders; |
126 Decoders video_decoder_hosts_; | 130 Decoders video_decoder_hosts_; |
127 | 131 |
128 // The last cached state received from the service. | 132 // The last cached state received from the service. |
129 State last_state_; | 133 State last_state_; |
apatrick_chromium
2012/02/13 20:50:58
Do we need to have two copied of the shared state?
| |
130 | 134 |
135 // The shared memory area used to update state. | |
136 gpu::CommandBufferSharedState* shared_state_; | |
137 | |
131 // |*this| is owned by |*channel_| and so is always outlived by it, so using a | 138 // |*this| is owned by |*channel_| and so is always outlived by it, so using a |
132 // raw pointer is ok. | 139 // raw pointer is ok. |
133 GpuChannelHost* channel_; | 140 GpuChannelHost* channel_; |
134 int route_id_; | 141 int route_id_; |
135 unsigned int flush_count_; | 142 unsigned int flush_count_; |
136 | 143 |
137 // Tasks to be invoked in echo responses. | 144 // Tasks to be invoked in echo responses. |
138 std::queue<base::Closure> echo_tasks_; | 145 std::queue<base::Closure> echo_tasks_; |
139 | 146 |
140 base::Closure notify_repaint_task_; | 147 base::Closure notify_repaint_task_; |
141 | 148 |
142 base::Closure channel_error_callback_; | 149 base::Closure channel_error_callback_; |
143 | 150 |
144 GpuConsoleMessageCallback console_message_callback_; | 151 GpuConsoleMessageCallback console_message_callback_; |
145 | 152 |
146 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); | 153 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); |
147 }; | 154 }; |
148 | 155 |
149 #endif // ENABLE_GPU | 156 #endif // ENABLE_GPU |
150 | 157 |
151 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ | 158 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ |
OLD | NEW |