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 GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 6 #define GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
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/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/containers/hash_tables.h" | 17 #include "base/containers/hash_tables.h" |
18 #include "base/containers/scoped_ptr_hash_map.h" | 18 #include "base/containers/scoped_ptr_hash_map.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
22 #include "base/observer_list.h" | 22 #include "base/observer_list.h" |
23 #include "gpu/command_buffer/client/gpu_control.h" | 23 #include "gpu/command_buffer/client/gpu_control.h" |
24 #include "gpu/command_buffer/common/command_buffer.h" | 24 #include "gpu/command_buffer/common/command_buffer.h" |
25 #include "gpu/command_buffer/common/command_buffer_id.h" | 25 #include "gpu/command_buffer/common/command_buffer_id.h" |
26 #include "gpu/command_buffer/common/command_buffer_shared.h" | 26 #include "gpu/command_buffer/common/command_buffer_shared.h" |
27 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 27 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| 28 #include "gpu/gpu_export.h" |
28 #include "ipc/ipc_listener.h" | 29 #include "ipc/ipc_listener.h" |
29 #include "ui/events/latency_info.h" | 30 #include "ui/events/latency_info.h" |
30 #include "ui/gfx/swap_result.h" | 31 #include "ui/gfx/swap_result.h" |
31 | 32 |
32 struct GPUCommandBufferConsoleMessage; | 33 struct GPUCommandBufferConsoleMessage; |
33 | 34 |
34 namespace base { | 35 namespace base { |
35 class SharedMemory; | 36 class SharedMemory; |
36 } | 37 } |
37 | 38 |
38 namespace gpu { | 39 namespace gpu { |
39 struct Mailbox; | 40 struct Mailbox; |
40 struct SyncToken; | 41 struct SyncToken; |
41 } | 42 } |
42 | 43 |
43 namespace content { | 44 namespace gpu { |
44 class GpuChannelHost; | 45 class GpuChannelHost; |
45 | 46 |
46 // Client side proxy that forwards messages synchronously to a | 47 // Client side proxy that forwards messages synchronously to a |
47 // CommandBufferStub. | 48 // CommandBufferStub. |
48 class CommandBufferProxyImpl | 49 class GPU_EXPORT CommandBufferProxyImpl |
49 : public gpu::CommandBuffer, | 50 : public gpu::CommandBuffer, |
50 public gpu::GpuControl, | 51 public gpu::GpuControl, |
51 public IPC::Listener, | 52 public IPC::Listener, |
52 public base::SupportsWeakPtr<CommandBufferProxyImpl> { | 53 public base::SupportsWeakPtr<CommandBufferProxyImpl> { |
53 public: | 54 public: |
54 class DeletionObserver { | 55 class DeletionObserver { |
55 public: | 56 public: |
56 // Called during the destruction of the CommandBufferProxyImpl. | 57 // Called during the destruction of the CommandBufferProxyImpl. |
57 virtual void OnWillDeleteImpl() = 0; | 58 virtual void OnWillDeleteImpl() = 0; |
58 | 59 |
59 protected: | 60 protected: |
60 virtual ~DeletionObserver() {} | 61 virtual ~DeletionObserver() {} |
61 }; | 62 }; |
62 | 63 |
63 typedef base::Callback<void( | 64 typedef base::Callback<void(const std::string& msg, int id)> |
64 const std::string& msg, int id)> GpuConsoleMessageCallback; | 65 GpuConsoleMessageCallback; |
65 | 66 |
66 CommandBufferProxyImpl(GpuChannelHost* channel, | 67 CommandBufferProxyImpl(GpuChannelHost* channel, |
67 int32_t route_id, | 68 int32_t route_id, |
68 int32_t stream_id); | 69 int32_t stream_id); |
69 ~CommandBufferProxyImpl() override; | 70 ~CommandBufferProxyImpl() override; |
70 | 71 |
71 // IPC::Listener implementation: | 72 // IPC::Listener implementation: |
72 bool OnMessageReceived(const IPC::Message& message) override; | 73 bool OnMessageReceived(const IPC::Message& message) override; |
73 void OnChannelError() override; | 74 void OnChannelError() override; |
74 | 75 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; | 113 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; |
113 | 114 |
114 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); | 115 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); |
115 void SetContextLostCallback(const base::Closure& callback); | 116 void SetContextLostCallback(const base::Closure& callback); |
116 | 117 |
117 void AddDeletionObserver(DeletionObserver* observer); | 118 void AddDeletionObserver(DeletionObserver* observer); |
118 void RemoveDeletionObserver(DeletionObserver* observer); | 119 void RemoveDeletionObserver(DeletionObserver* observer); |
119 | 120 |
120 bool EnsureBackbuffer(); | 121 bool EnsureBackbuffer(); |
121 | 122 |
122 void SetOnConsoleMessageCallback( | 123 void SetOnConsoleMessageCallback(const GpuConsoleMessageCallback& callback); |
123 const GpuConsoleMessageCallback& callback); | |
124 | 124 |
125 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 125 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
126 using SwapBuffersCompletionCallback = | 126 using SwapBuffersCompletionCallback = |
127 base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info, | 127 base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info, |
128 gfx::SwapResult result)>; | 128 gfx::SwapResult result)>; |
129 void SetSwapBuffersCompletionCallback( | 129 void SetSwapBuffersCompletionCallback( |
130 const SwapBuffersCompletionCallback& callback); | 130 const SwapBuffersCompletionCallback& callback); |
131 | 131 |
132 using UpdateVSyncParametersCallback = | 132 using UpdateVSyncParametersCallback = |
133 base::Callback<void(base::TimeTicks timebase, base::TimeDelta interval)>; | 133 base::Callback<void(base::TimeTicks timebase, base::TimeDelta interval)>; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 SwapBuffersCompletionCallback swap_buffers_completion_callback_; | 243 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
244 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; | 244 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; |
245 | 245 |
246 base::WeakPtr<CommandBufferProxyImpl> weak_this_; | 246 base::WeakPtr<CommandBufferProxyImpl> weak_this_; |
247 scoped_refptr<base::SequencedTaskRunner> callback_thread_; | 247 scoped_refptr<base::SequencedTaskRunner> callback_thread_; |
248 | 248 |
249 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 249 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
250 }; | 250 }; |
251 | 251 |
252 } // namespace content | 252 } // namespace gpu |
253 | 253 |
254 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 254 #endif // GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |