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/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "content/common/gpu/gpu_command_buffer_stub.h" | 17 #include "content/common/gpu/gpu_command_buffer_stub.h" |
18 #include "content/common/gpu/gpu_memory_manager.h" | 18 #include "content/common/gpu/gpu_memory_manager.h" |
19 #include "content/common/message_router.h" | 19 #include "content/common/message_router.h" |
20 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
21 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
22 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
23 #include "ui/gl/gl_share_group.h" | 23 #include "ui/gl/gl_share_group.h" |
24 #include "ui/gl/gpu_preference.h" | 24 #include "ui/gl/gpu_preference.h" |
25 | 25 |
26 #if defined(OS_ANDROID) | |
27 #include "content/common/android/surface_texture_peer.h" | |
28 #endif | |
29 | |
30 struct GPUCreateCommandBufferConfig; | 26 struct GPUCreateCommandBufferConfig; |
31 | 27 |
32 namespace base { | 28 namespace base { |
33 class MessageLoopProxy; | 29 class MessageLoopProxy; |
34 class WaitableEvent; | 30 class WaitableEvent; |
35 } | 31 } |
36 | 32 |
37 namespace gpu { | 33 namespace gpu { |
38 class PreemptionFlag; | 34 class PreemptionFlag; |
39 namespace gles2 { | 35 namespace gles2 { |
40 class ImageManager; | 36 class ImageManager; |
41 } | 37 } |
42 } | 38 } |
43 | 39 |
44 #if defined(OS_ANDROID) | |
45 namespace content { | |
46 class StreamTextureManagerAndroid; | |
47 } | |
48 #endif | |
49 | |
50 namespace content { | 40 namespace content { |
51 class GpuChannelManager; | 41 class GpuChannelManager; |
52 struct GpuRenderingStats; | 42 struct GpuRenderingStats; |
53 class GpuWatchdog; | 43 class GpuWatchdog; |
54 class GpuChannelMessageFilter; | 44 class GpuChannelMessageFilter; |
55 | 45 |
56 // Encapsulates an IPC channel between the GPU process and one renderer | 46 // Encapsulates an IPC channel between the GPU process and one renderer |
57 // process. On the renderer side there's a corresponding GpuChannelHost. | 47 // process. On the renderer side there's a corresponding GpuChannelHost. |
58 class GpuChannel : public IPC::Listener, | 48 class GpuChannel : public IPC::Listener, |
59 public IPC::Sender, | 49 public IPC::Sender, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 gpu::PreemptionFlag* GetPreemptionFlag(); | 129 gpu::PreemptionFlag* GetPreemptionFlag(); |
140 | 130 |
141 bool handle_messages_scheduled() const { return handle_messages_scheduled_; } | 131 bool handle_messages_scheduled() const { return handle_messages_scheduled_; } |
142 uint64 messages_processed() const { return messages_processed_; } | 132 uint64 messages_processed() const { return messages_processed_; } |
143 | 133 |
144 // If |preemption_flag->IsSet()|, any stub on this channel | 134 // If |preemption_flag->IsSet()|, any stub on this channel |
145 // should stop issuing GL commands. Setting this to NULL stops deferral. | 135 // should stop issuing GL commands. Setting this to NULL stops deferral. |
146 void SetPreemptByFlag( | 136 void SetPreemptByFlag( |
147 scoped_refptr<gpu::PreemptionFlag> preemption_flag); | 137 scoped_refptr<gpu::PreemptionFlag> preemption_flag); |
148 | 138 |
149 #if defined(OS_ANDROID) | |
150 StreamTextureManagerAndroid* stream_texture_manager() { | |
151 return stream_texture_manager_.get(); | |
152 } | |
153 #endif | |
154 | |
155 void CacheShader(const std::string& key, const std::string& shader); | 139 void CacheShader(const std::string& key, const std::string& shader); |
156 | 140 |
157 protected: | 141 protected: |
158 virtual ~GpuChannel(); | 142 virtual ~GpuChannel(); |
159 | 143 |
160 private: | 144 private: |
161 friend class base::RefCountedThreadSafe<GpuChannel>; | 145 friend class base::RefCountedThreadSafe<GpuChannel>; |
162 friend class GpuChannelMessageFilter; | 146 friend class GpuChannelMessageFilter; |
163 | 147 |
164 void OnDestroy(); | 148 void OnDestroy(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 206 |
223 // Used to implement message routing functionality to CommandBuffer objects | 207 // Used to implement message routing functionality to CommandBuffer objects |
224 MessageRouter router_; | 208 MessageRouter router_; |
225 | 209 |
226 // The share group that all contexts associated with a particular renderer | 210 // The share group that all contexts associated with a particular renderer |
227 // process use. | 211 // process use. |
228 scoped_refptr<gfx::GLShareGroup> share_group_; | 212 scoped_refptr<gfx::GLShareGroup> share_group_; |
229 | 213 |
230 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 214 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
231 scoped_refptr<gpu::gles2::ImageManager> image_manager_; | 215 scoped_refptr<gpu::gles2::ImageManager> image_manager_; |
232 #if defined(OS_ANDROID) | |
233 scoped_ptr<StreamTextureManagerAndroid> stream_texture_manager_; | |
234 #endif | |
235 | 216 |
236 #if defined(ENABLE_GPU) | 217 #if defined(ENABLE_GPU) |
237 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 218 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
238 StubMap stubs_; | 219 StubMap stubs_; |
239 #endif // defined (ENABLE_GPU) | 220 #endif // defined (ENABLE_GPU) |
240 | 221 |
241 bool log_messages_; // True if we should log sent and received messages. | 222 bool log_messages_; // True if we should log sent and received messages. |
242 gpu::gles2::DisallowedFeatures disallowed_features_; | 223 gpu::gles2::DisallowedFeatures disallowed_features_; |
243 GpuWatchdog* watchdog_; | 224 GpuWatchdog* watchdog_; |
244 bool software_; | 225 bool software_; |
245 bool handle_messages_scheduled_; | 226 bool handle_messages_scheduled_; |
246 bool processed_get_state_fast_; | 227 bool processed_get_state_fast_; |
247 IPC::Message* currently_processing_message_; | 228 IPC::Message* currently_processing_message_; |
248 | 229 |
249 base::WeakPtrFactory<GpuChannel> weak_factory_; | 230 base::WeakPtrFactory<GpuChannel> weak_factory_; |
250 | 231 |
251 scoped_refptr<GpuChannelMessageFilter> filter_; | 232 scoped_refptr<GpuChannelMessageFilter> filter_; |
252 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 233 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
253 | 234 |
254 size_t num_stubs_descheduled_; | 235 size_t num_stubs_descheduled_; |
255 | 236 |
256 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 237 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
257 }; | 238 }; |
258 | 239 |
259 } // namespace content | 240 } // namespace content |
260 | 241 |
261 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 242 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |