| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/containers/scoped_ptr_hash_map.h" | 15 #include "base/containers/scoped_ptr_hash_map.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "gpu/command_buffer/client/gpu_control.h" | 19 #include "gpu/command_buffer/client/gpu_control.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 "gpu/command_buffer/common/command_buffer_shared.h" |
| 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| 23 #include "ipc/ipc_listener.h" | 23 #include "ipc/ipc_listener.h" |
| 24 #include "ui/events/latency_info.h" | 24 #include "ui/events/latency_info.h" |
| 25 #include "ui/gfx/swap_result.h" | |
| 26 | 25 |
| 27 struct GPUCommandBufferConsoleMessage; | 26 struct GPUCommandBufferConsoleMessage; |
| 28 | 27 |
| 29 namespace base { | 28 namespace base { |
| 30 class SharedMemory; | 29 class SharedMemory; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace gpu { | 32 namespace gpu { |
| 34 struct Mailbox; | 33 struct Mailbox; |
| 35 } | 34 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void AddDeletionObserver(DeletionObserver* observer); | 129 void AddDeletionObserver(DeletionObserver* observer); |
| 131 void RemoveDeletionObserver(DeletionObserver* observer); | 130 void RemoveDeletionObserver(DeletionObserver* observer); |
| 132 | 131 |
| 133 bool EnsureBackbuffer(); | 132 bool EnsureBackbuffer(); |
| 134 | 133 |
| 135 void SetOnConsoleMessageCallback( | 134 void SetOnConsoleMessageCallback( |
| 136 const GpuConsoleMessageCallback& callback); | 135 const GpuConsoleMessageCallback& callback); |
| 137 | 136 |
| 138 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 137 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 139 using SwapBuffersCompletionCallback = | 138 using SwapBuffersCompletionCallback = |
| 140 base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info, | 139 base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info)>; |
| 141 gfx::SwapResult result)>; | |
| 142 void SetSwapBuffersCompletionCallback( | 140 void SetSwapBuffersCompletionCallback( |
| 143 const SwapBuffersCompletionCallback& callback); | 141 const SwapBuffersCompletionCallback& callback); |
| 144 | 142 |
| 145 using UpdateVSyncParametersCallback = | 143 using UpdateVSyncParametersCallback = |
| 146 base::Callback<void(base::TimeTicks timebase, base::TimeDelta interval)>; | 144 base::Callback<void(base::TimeTicks timebase, base::TimeDelta interval)>; |
| 147 void SetUpdateVSyncParametersCallback( | 145 void SetUpdateVSyncParametersCallback( |
| 148 const UpdateVSyncParametersCallback& callback); | 146 const UpdateVSyncParametersCallback& callback); |
| 149 | 147 |
| 150 // TODO(apatrick): this is a temporary optimization while skia is calling | 148 // TODO(apatrick): this is a temporary optimization while skia is calling |
| 151 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 | 149 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 175 // verify that the context has not been lost. | 173 // verify that the context has not been lost. |
| 176 bool Send(IPC::Message* msg); | 174 bool Send(IPC::Message* msg); |
| 177 | 175 |
| 178 // Message handlers: | 176 // Message handlers: |
| 179 void OnUpdateState(const gpu::CommandBuffer::State& state); | 177 void OnUpdateState(const gpu::CommandBuffer::State& state); |
| 180 void OnDestroyed(gpu::error::ContextLostReason reason, | 178 void OnDestroyed(gpu::error::ContextLostReason reason, |
| 181 gpu::error::Error error); | 179 gpu::error::Error error); |
| 182 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 180 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
| 183 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 181 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
| 184 void OnSignalSyncPointAck(uint32 id); | 182 void OnSignalSyncPointAck(uint32 id); |
| 185 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | 183 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); |
| 186 gfx::SwapResult result); | |
| 187 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 184 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 188 base::TimeDelta interval); | 185 base::TimeDelta interval); |
| 189 | 186 |
| 190 // Try to read an updated copy of the state from shared memory. | 187 // Try to read an updated copy of the state from shared memory. |
| 191 void TryUpdateState(); | 188 void TryUpdateState(); |
| 192 | 189 |
| 193 // The shared memory area used to update state. | 190 // The shared memory area used to update state. |
| 194 gpu::CommandBufferSharedState* shared_state() const; | 191 gpu::CommandBufferSharedState* shared_state() const; |
| 195 | 192 |
| 196 base::Lock* lock_; | 193 base::Lock* lock_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 228 |
| 232 SwapBuffersCompletionCallback swap_buffers_completion_callback_; | 229 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
| 233 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; | 230 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; |
| 234 | 231 |
| 235 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 232 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
| 236 }; | 233 }; |
| 237 | 234 |
| 238 } // namespace content | 235 } // namespace content |
| 239 | 236 |
| 240 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 237 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| OLD | NEW |