| 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_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 int32* id) OVERRIDE; | 105 int32* id) OVERRIDE; |
| 106 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; | 106 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; |
| 107 virtual uint32 InsertSyncPoint() OVERRIDE; | 107 virtual uint32 InsertSyncPoint() OVERRIDE; |
| 108 virtual uint32_t InsertFutureSyncPoint() OVERRIDE; | 108 virtual uint32_t InsertFutureSyncPoint() OVERRIDE; |
| 109 virtual void RetireSyncPoint(uint32_t sync_point) OVERRIDE; | 109 virtual void RetireSyncPoint(uint32_t sync_point) OVERRIDE; |
| 110 virtual void SignalSyncPoint(uint32 sync_point, | 110 virtual void SignalSyncPoint(uint32 sync_point, |
| 111 const base::Closure& callback) OVERRIDE; | 111 const base::Closure& callback) OVERRIDE; |
| 112 virtual void SignalQuery(uint32 query, | 112 virtual void SignalQuery(uint32 query, |
| 113 const base::Closure& callback) OVERRIDE; | 113 const base::Closure& callback) OVERRIDE; |
| 114 virtual void SetSurfaceVisible(bool visible) OVERRIDE; | 114 virtual void SetSurfaceVisible(bool visible) OVERRIDE; |
| 115 virtual void Echo(const base::Closure& callback) OVERRIDE; | |
| 116 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; | 115 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; |
| 117 | 116 |
| 118 int GetRouteID() const; | 117 int GetRouteID() const; |
| 119 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); | 118 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); |
| 120 void SetChannelErrorCallback(const base::Closure& callback); | 119 void SetChannelErrorCallback(const base::Closure& callback); |
| 121 | 120 |
| 122 typedef base::Callback<void(const gpu::MemoryAllocation&)> | 121 typedef base::Callback<void(const gpu::MemoryAllocation&)> |
| 123 MemoryAllocationChangedCallback; | 122 MemoryAllocationChangedCallback; |
| 124 void SetMemoryAllocationChangedCallback( | 123 void SetMemoryAllocationChangedCallback( |
| 125 const MemoryAllocationChangedCallback& callback); | 124 const MemoryAllocationChangedCallback& callback); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 152 GpuMemoryBufferMap; | 151 GpuMemoryBufferMap; |
| 153 | 152 |
| 154 // Send an IPC message over the GPU channel. This is private to fully | 153 // Send an IPC message over the GPU channel. This is private to fully |
| 155 // encapsulate the channel; all callers of this function must explicitly | 154 // encapsulate the channel; all callers of this function must explicitly |
| 156 // verify that the context has not been lost. | 155 // verify that the context has not been lost. |
| 157 bool Send(IPC::Message* msg); | 156 bool Send(IPC::Message* msg); |
| 158 | 157 |
| 159 // Message handlers: | 158 // Message handlers: |
| 160 void OnUpdateState(const gpu::CommandBuffer::State& state); | 159 void OnUpdateState(const gpu::CommandBuffer::State& state); |
| 161 void OnDestroyed(gpu::error::ContextLostReason reason); | 160 void OnDestroyed(gpu::error::ContextLostReason reason); |
| 162 void OnEchoAck(); | |
| 163 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 161 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
| 164 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 162 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
| 165 void OnSignalSyncPointAck(uint32 id); | 163 void OnSignalSyncPointAck(uint32 id); |
| 166 | 164 |
| 167 // Try to read an updated copy of the state from shared memory. | 165 // Try to read an updated copy of the state from shared memory. |
| 168 void TryUpdateState(); | 166 void TryUpdateState(); |
| 169 | 167 |
| 170 // The shared memory area used to update state. | 168 // The shared memory area used to update state. |
| 171 gpu::CommandBufferSharedState* shared_state() const; | 169 gpu::CommandBufferSharedState* shared_state() const; |
| 172 | 170 |
| 173 // Unowned list of DeletionObservers. | 171 // Unowned list of DeletionObservers. |
| 174 ObserverList<DeletionObserver> deletion_observers_; | 172 ObserverList<DeletionObserver> deletion_observers_; |
| 175 | 173 |
| 176 // The last cached state received from the service. | 174 // The last cached state received from the service. |
| 177 State last_state_; | 175 State last_state_; |
| 178 | 176 |
| 179 // The shared memory area used to update state. | 177 // The shared memory area used to update state. |
| 180 scoped_ptr<base::SharedMemory> shared_state_shm_; | 178 scoped_ptr<base::SharedMemory> shared_state_shm_; |
| 181 | 179 |
| 182 // |*this| is owned by |*channel_| and so is always outlived by it, so using a | 180 // |*this| is owned by |*channel_| and so is always outlived by it, so using a |
| 183 // raw pointer is ok. | 181 // raw pointer is ok. |
| 184 GpuChannelHost* channel_; | 182 GpuChannelHost* channel_; |
| 185 int route_id_; | 183 int route_id_; |
| 186 unsigned int flush_count_; | 184 unsigned int flush_count_; |
| 187 int32 last_put_offset_; | 185 int32 last_put_offset_; |
| 188 | 186 |
| 189 // Tasks to be invoked in echo responses. | |
| 190 std::queue<base::Closure> echo_tasks_; | |
| 191 | |
| 192 base::Closure channel_error_callback_; | 187 base::Closure channel_error_callback_; |
| 193 | 188 |
| 194 MemoryAllocationChangedCallback memory_allocation_changed_callback_; | 189 MemoryAllocationChangedCallback memory_allocation_changed_callback_; |
| 195 | 190 |
| 196 GpuConsoleMessageCallback console_message_callback_; | 191 GpuConsoleMessageCallback console_message_callback_; |
| 197 | 192 |
| 198 // Tasks to be invoked in SignalSyncPoint responses. | 193 // Tasks to be invoked in SignalSyncPoint responses. |
| 199 uint32 next_signal_id_; | 194 uint32 next_signal_id_; |
| 200 SignalTaskMap signal_tasks_; | 195 SignalTaskMap signal_tasks_; |
| 201 | 196 |
| 202 // Local cache of id to gpu memory buffer mapping. | 197 // Local cache of id to gpu memory buffer mapping. |
| 203 GpuMemoryBufferMap gpu_memory_buffers_; | 198 GpuMemoryBufferMap gpu_memory_buffers_; |
| 204 | 199 |
| 205 gpu::Capabilities capabilities_; | 200 gpu::Capabilities capabilities_; |
| 206 | 201 |
| 207 std::vector<ui::LatencyInfo> latency_info_; | 202 std::vector<ui::LatencyInfo> latency_info_; |
| 208 | 203 |
| 209 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 204 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
| 210 }; | 205 }; |
| 211 | 206 |
| 212 } // namespace content | 207 } // namespace content |
| 213 | 208 |
| 214 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 209 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| OLD | NEW |