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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "content/common/gpu/gpu_result_codes.h" | 25 #include "content/common/gpu/gpu_result_codes.h" |
26 #include "content/common/gpu/gpu_stream_priority.h" | 26 #include "content/common/gpu/gpu_stream_priority.h" |
27 #include "content/common/message_router.h" | 27 #include "content/common/message_router.h" |
28 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 28 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
29 #include "ipc/ipc_sync_channel.h" | 29 #include "ipc/ipc_sync_channel.h" |
30 #include "ui/gfx/geometry/size.h" | 30 #include "ui/gfx/geometry/size.h" |
31 #include "ui/gfx/native_widget_types.h" | 31 #include "ui/gfx/native_widget_types.h" |
32 #include "ui/gl/gl_share_group.h" | 32 #include "ui/gl/gl_share_group.h" |
33 #include "ui/gl/gpu_preference.h" | 33 #include "ui/gl/gpu_preference.h" |
34 | 34 |
35 struct GPUCreateCommandBufferConfig; | |
36 | |
37 namespace base { | 35 namespace base { |
38 class WaitableEvent; | 36 class WaitableEvent; |
39 } | 37 } |
40 | 38 |
41 namespace gpu { | 39 namespace gpu { |
42 class PreemptionFlag; | 40 class PreemptionFlag; |
43 class SyncPointOrderData; | 41 class SyncPointOrderData; |
44 class SyncPointManager; | 42 class SyncPointManager; |
45 union ValueState; | 43 union ValueState; |
46 class ValueStateMap; | 44 class ValueStateMap; |
47 namespace gles2 { | 45 namespace gles2 { |
48 class SubscriptionRefSet; | 46 class SubscriptionRefSet; |
49 } | 47 } |
50 } | 48 } |
51 | 49 |
52 namespace IPC { | 50 namespace IPC { |
53 class MessageFilter; | 51 class MessageFilter; |
54 } | 52 } |
55 | 53 |
56 namespace content { | 54 namespace content { |
57 class GpuChannelManager; | 55 class GpuChannelManager; |
58 class GpuChannelMessageFilter; | 56 class GpuChannelMessageFilter; |
59 class GpuChannelMessageQueue; | 57 class GpuChannelMessageQueue; |
60 class GpuJpegDecodeAccelerator; | 58 class GpuJpegDecodeAccelerator; |
61 class GpuWatchdog; | 59 class GpuWatchdog; |
| 60 struct GpuCreateCommandBufferConfig; |
62 | 61 |
63 // Encapsulates an IPC channel between the GPU process and one renderer | 62 // Encapsulates an IPC channel between the GPU process and one renderer |
64 // process. On the renderer side there's a corresponding GpuChannelHost. | 63 // process. On the renderer side there's a corresponding GpuChannelHost. |
65 class CONTENT_EXPORT GpuChannel | 64 class CONTENT_EXPORT GpuChannel |
66 : public IPC::Listener, | 65 : public IPC::Listener, |
67 public IPC::Sender, | 66 public IPC::Sender, |
68 public gpu::gles2::SubscriptionRefSet::Observer { | 67 public gpu::gles2::SubscriptionRefSet::Observer { |
69 public: | 68 public: |
70 // Takes ownership of the renderer process handle. | 69 // Takes ownership of the renderer process handle. |
71 GpuChannel(GpuChannelManager* gpu_channel_manager, | 70 GpuChannel(GpuChannelManager* gpu_channel_manager, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void OnAddSubscription(unsigned int target) override; | 112 void OnAddSubscription(unsigned int target) override; |
114 void OnRemoveSubscription(unsigned int target) override; | 113 void OnRemoveSubscription(unsigned int target) override; |
115 | 114 |
116 // This is called when a command buffer transitions between scheduled and | 115 // This is called when a command buffer transitions between scheduled and |
117 // descheduled states. When any stub is descheduled, we stop preempting | 116 // descheduled states. When any stub is descheduled, we stop preempting |
118 // other channels. | 117 // other channels. |
119 void OnStubSchedulingChanged(GpuCommandBufferStub* stub, bool scheduled); | 118 void OnStubSchedulingChanged(GpuCommandBufferStub* stub, bool scheduled); |
120 | 119 |
121 CreateCommandBufferResult CreateViewCommandBuffer( | 120 CreateCommandBufferResult CreateViewCommandBuffer( |
122 const gfx::GLSurfaceHandle& window, | 121 const gfx::GLSurfaceHandle& window, |
123 const GPUCreateCommandBufferConfig& init_params, | 122 const GpuCreateCommandBufferConfig& init_params, |
124 int32_t route_id); | 123 int32_t route_id); |
125 | 124 |
126 gfx::GLShareGroup* share_group() const { return share_group_.get(); } | 125 gfx::GLShareGroup* share_group() const { return share_group_.get(); } |
127 | 126 |
128 GpuCommandBufferStub* LookupCommandBuffer(int32_t route_id); | 127 GpuCommandBufferStub* LookupCommandBuffer(int32_t route_id); |
129 | 128 |
130 void LoseAllContexts(); | 129 void LoseAllContexts(); |
131 void MarkAllContextsLost(); | 130 void MarkAllContextsLost(); |
132 | 131 |
133 // Called to add a listener for a particular message routing ID. | 132 // Called to add a listener for a particular message routing ID. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 216 |
218 void OnDestroy(); | 217 void OnDestroy(); |
219 | 218 |
220 bool OnControlMessageReceived(const IPC::Message& msg); | 219 bool OnControlMessageReceived(const IPC::Message& msg); |
221 | 220 |
222 void ScheduleHandleMessage(); | 221 void ScheduleHandleMessage(); |
223 | 222 |
224 // Message handlers. | 223 // Message handlers. |
225 void OnCreateOffscreenCommandBuffer( | 224 void OnCreateOffscreenCommandBuffer( |
226 const gfx::Size& size, | 225 const gfx::Size& size, |
227 const GPUCreateCommandBufferConfig& init_params, | 226 const GpuCreateCommandBufferConfig& init_params, |
228 int32_t route_id, | 227 int32_t route_id, |
229 bool* succeeded); | 228 bool* succeeded); |
230 void OnDestroyCommandBuffer(int32_t route_id); | 229 void OnDestroyCommandBuffer(int32_t route_id); |
231 void OnCreateJpegDecoder(int32_t route_id, IPC::Message* reply_msg); | 230 void OnCreateJpegDecoder(int32_t route_id, IPC::Message* reply_msg); |
232 | 231 |
233 // The lifetime of objects of this class is managed by a GpuChannelManager. | 232 // The lifetime of objects of this class is managed by a GpuChannelManager. |
234 // The GpuChannelManager destroy all the GpuChannels that they own when they | 233 // The GpuChannelManager destroy all the GpuChannels that they own when they |
235 // are destroyed. So a raw pointer is safe. | 234 // are destroyed. So a raw pointer is safe. |
236 GpuChannelManager* gpu_channel_manager_; | 235 GpuChannelManager* gpu_channel_manager_; |
237 | 236 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 base::WeakPtr<GpuChannel> gpu_channel_; | 457 base::WeakPtr<GpuChannel> gpu_channel_; |
459 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 458 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
460 gpu::SyncPointManager* sync_point_manager_; | 459 gpu::SyncPointManager* sync_point_manager_; |
461 | 460 |
462 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); | 461 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); |
463 }; | 462 }; |
464 | 463 |
465 } // namespace content | 464 } // namespace content |
466 | 465 |
467 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 466 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |