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_GPU_CHANNEL_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/common/gpu/gpu_command_buffer_stub.h" | 18 #include "content/common/gpu/gpu_command_buffer_stub.h" |
19 #include "content/common/gpu/gpu_memory_manager.h" | 19 #include "content/common/gpu/gpu_memory_manager.h" |
20 #include "content/common/gpu/gpu_result_codes.h" | 20 #include "content/common/gpu/gpu_result_codes.h" |
21 #include "content/common/message_router.h" | 21 #include "content/common/message_router.h" |
| 22 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
22 #include "ipc/ipc_sync_channel.h" | 23 #include "ipc/ipc_sync_channel.h" |
23 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
24 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
25 #include "ui/gl/gl_share_group.h" | 26 #include "ui/gl/gl_share_group.h" |
26 #include "ui/gl/gpu_preference.h" | 27 #include "ui/gl/gpu_preference.h" |
27 | 28 |
28 struct GPUCreateCommandBufferConfig; | 29 struct GPUCreateCommandBufferConfig; |
29 | 30 |
30 namespace base { | 31 namespace base { |
31 class MessageLoopProxy; | 32 class MessageLoopProxy; |
32 class WaitableEvent; | 33 class WaitableEvent; |
33 } | 34 } |
34 | 35 |
35 namespace gpu { | 36 namespace gpu { |
36 class PreemptionFlag; | 37 class PreemptionFlag; |
37 union ValueState; | 38 union ValueState; |
38 class ValueStateMap; | 39 class ValueStateMap; |
39 namespace gles2 { | 40 namespace gles2 { |
| 41 class SubscriptionRefSet; |
40 } | 42 } |
41 } | 43 } |
42 | 44 |
43 namespace IPC { | 45 namespace IPC { |
44 class MessageFilter; | 46 class MessageFilter; |
45 } | 47 } |
46 | 48 |
47 namespace content { | 49 namespace content { |
48 class DevToolsGpuAgent; | 50 class DevToolsGpuAgent; |
49 class GpuChannelManager; | 51 class GpuChannelManager; |
50 class GpuChannelMessageFilter; | 52 class GpuChannelMessageFilter; |
51 class GpuWatchdog; | 53 class GpuWatchdog; |
52 | 54 |
53 // Encapsulates an IPC channel between the GPU process and one renderer | 55 // Encapsulates an IPC channel between the GPU process and one renderer |
54 // process. On the renderer side there's a corresponding GpuChannelHost. | 56 // process. On the renderer side there's a corresponding GpuChannelHost. |
55 class GpuChannel : public IPC::Listener, public IPC::Sender { | 57 class GpuChannel : public IPC::Listener, public IPC::Sender, |
| 58 public gpu::gles2::SubscriptionRefSet::Observer { |
56 public: | 59 public: |
57 // Takes ownership of the renderer process handle. | 60 // Takes ownership of the renderer process handle. |
58 GpuChannel(GpuChannelManager* gpu_channel_manager, | 61 GpuChannel(GpuChannelManager* gpu_channel_manager, |
59 GpuWatchdog* watchdog, | 62 GpuWatchdog* watchdog, |
60 gfx::GLShareGroup* share_group, | 63 gfx::GLShareGroup* share_group, |
61 gpu::gles2::MailboxManager* mailbox_manager, | 64 gpu::gles2::MailboxManager* mailbox_manager, |
62 int client_id, | 65 int client_id, |
63 bool software, | 66 bool software, |
64 bool allow_future_sync_points); | 67 bool allow_future_sync_points); |
65 ~GpuChannel() override; | 68 ~GpuChannel() override; |
(...skipping 26 matching lines...) Expand all Loading... |
92 void OnChannelError() override; | 95 void OnChannelError() override; |
93 | 96 |
94 // IPC::Sender implementation: | 97 // IPC::Sender implementation: |
95 bool Send(IPC::Message* msg) override; | 98 bool Send(IPC::Message* msg) override; |
96 | 99 |
97 // Requeue the message that is currently being processed to the beginning of | 100 // Requeue the message that is currently being processed to the beginning of |
98 // the queue. Used when the processing of a message gets aborted because of | 101 // the queue. Used when the processing of a message gets aborted because of |
99 // unscheduling conditions. | 102 // unscheduling conditions. |
100 void RequeueMessage(); | 103 void RequeueMessage(); |
101 | 104 |
| 105 // SubscriptionRefSet::Observer implementation |
| 106 void OnAddSubscription(unsigned int target) override; |
| 107 void OnRemoveSubscription(unsigned int target) override; |
| 108 |
102 // This is called when a command buffer transitions from the unscheduled | 109 // This is called when a command buffer transitions from the unscheduled |
103 // state to the scheduled state, which potentially means the channel | 110 // state to the scheduled state, which potentially means the channel |
104 // transitions from the unscheduled to the scheduled state. When this occurs | 111 // transitions from the unscheduled to the scheduled state. When this occurs |
105 // deferred IPC messaged are handled. | 112 // deferred IPC messaged are handled. |
106 void OnScheduled(); | 113 void OnScheduled(); |
107 | 114 |
108 // This is called when a command buffer transitions between scheduled and | 115 // This is called when a command buffer transitions between scheduled and |
109 // descheduled states. When any stub is descheduled, we stop preempting | 116 // descheduled states. When any stub is descheduled, we stop preempting |
110 // other channels. | 117 // other channels. |
111 void StubSchedulingChanged(bool scheduled); | 118 void StubSchedulingChanged(bool scheduled); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 219 |
213 // Used to implement message routing functionality to CommandBuffer objects | 220 // Used to implement message routing functionality to CommandBuffer objects |
214 MessageRouter router_; | 221 MessageRouter router_; |
215 | 222 |
216 // The share group that all contexts associated with a particular renderer | 223 // The share group that all contexts associated with a particular renderer |
217 // process use. | 224 // process use. |
218 scoped_refptr<gfx::GLShareGroup> share_group_; | 225 scoped_refptr<gfx::GLShareGroup> share_group_; |
219 | 226 |
220 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 227 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
221 | 228 |
| 229 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; |
| 230 |
222 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; | 231 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
223 | 232 |
224 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 233 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
225 StubMap stubs_; | 234 StubMap stubs_; |
226 | 235 |
227 bool log_messages_; // True if we should log sent and received messages. | 236 bool log_messages_; // True if we should log sent and received messages. |
228 gpu::gles2::DisallowedFeatures disallowed_features_; | 237 gpu::gles2::DisallowedFeatures disallowed_features_; |
229 GpuWatchdog* watchdog_; | 238 GpuWatchdog* watchdog_; |
230 bool software_; | 239 bool software_; |
231 bool handle_messages_scheduled_; | 240 bool handle_messages_scheduled_; |
(...skipping 11 matching lines...) Expand all Loading... |
243 // that any WeakPtrs to Controller are invalidated before its members | 252 // that any WeakPtrs to Controller are invalidated before its members |
244 // variable's destructors are executed, rendering them invalid. | 253 // variable's destructors are executed, rendering them invalid. |
245 base::WeakPtrFactory<GpuChannel> weak_factory_; | 254 base::WeakPtrFactory<GpuChannel> weak_factory_; |
246 | 255 |
247 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 256 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
248 }; | 257 }; |
249 | 258 |
250 } // namespace content | 259 } // namespace content |
251 | 260 |
252 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 261 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |