| 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 #include <vector> |
| 10 | 11 |
| 11 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/process.h" | 16 #include "base/process.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "content/common/gpu/gpu_command_buffer_stub.h" | 18 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 18 #include "content/common/gpu/gpu_memory_manager.h" | 19 #include "content/common/gpu/gpu_memory_manager.h" |
| 19 #include "content/common/message_router.h" | 20 #include "content/common/message_router.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 struct GPUCreateCommandBufferConfig; | 32 struct GPUCreateCommandBufferConfig; |
| 32 class GpuWatchdog; | 33 class GpuWatchdog; |
| 33 | 34 |
| 34 namespace base { | 35 namespace base { |
| 35 class MessageLoopProxy; | 36 class MessageLoopProxy; |
| 36 class WaitableEvent; | 37 class WaitableEvent; |
| 37 } | 38 } |
| 38 | 39 |
| 39 namespace gpu { | 40 namespace gpu { |
| 40 struct RefCountedCounter; | 41 struct RefCountedCounter; |
| 42 namespace gles2 { |
| 43 class ProgramCache; |
| 44 } |
| 41 } | 45 } |
| 42 | 46 |
| 43 #if defined(OS_ANDROID) | 47 #if defined(OS_ANDROID) |
| 44 namespace content { | 48 namespace content { |
| 45 class StreamTextureManagerAndroid; | 49 class StreamTextureManagerAndroid; |
| 46 } | 50 } |
| 47 #endif | 51 #endif |
| 48 | 52 |
| 49 // Encapsulates an IPC channel between the GPU process and one renderer | 53 // Encapsulates an IPC channel between the GPU process and one renderer |
| 50 // process. On the renderer side there's a corresponding GpuChannelHost. | 54 // process. On the renderer side there's a corresponding GpuChannelHost. |
| 51 class GpuChannel : public IPC::Listener, | 55 class GpuChannel : public IPC::Listener, |
| 52 public IPC::Sender, | 56 public IPC::Sender, |
| 53 public base::RefCountedThreadSafe<GpuChannel> { | 57 public base::RefCountedThreadSafe<GpuChannel> { |
| 54 public: | 58 public: |
| 55 // Takes ownership of the renderer process handle. | 59 // Takes ownership of the renderer process handle. |
| 56 GpuChannel(GpuChannelManager* gpu_channel_manager, | 60 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 57 GpuWatchdog* watchdog, | 61 GpuWatchdog* watchdog, |
| 58 gfx::GLShareGroup* share_group, | 62 gfx::GLShareGroup* share_group, |
| 59 gpu::gles2::MailboxManager* mailbox_manager, | 63 gpu::gles2::MailboxManager* mailbox_manager, |
| 60 int client_id, | 64 int client_id, |
| 61 bool software); | 65 bool software, |
| 66 gpu::gles2::ProgramCache* program_cache); |
| 62 | 67 |
| 63 bool Init(base::MessageLoopProxy* io_message_loop, | 68 bool Init(base::MessageLoopProxy* io_message_loop, |
| 64 base::WaitableEvent* shutdown_event); | 69 base::WaitableEvent* shutdown_event); |
| 65 | 70 |
| 66 // Get the GpuChannelManager that owns this channel. | 71 // Get the GpuChannelManager that owns this channel. |
| 67 GpuChannelManager* gpu_channel_manager() const { | 72 GpuChannelManager* gpu_channel_manager() const { |
| 68 return gpu_channel_manager_; | 73 return gpu_channel_manager_; |
| 69 } | 74 } |
| 70 | 75 |
| 71 // Returns the name of the associated IPC channel. | 76 // Returns the name of the associated IPC channel. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void OnEstablishStreamTexture( | 159 void OnEstablishStreamTexture( |
| 155 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, | 160 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, |
| 156 int32 primary_id, int32 secondary_id); | 161 int32 primary_id, int32 secondary_id); |
| 157 #endif | 162 #endif |
| 158 | 163 |
| 159 // The lifetime of objects of this class is managed by a GpuChannelManager. | 164 // The lifetime of objects of this class is managed by a GpuChannelManager. |
| 160 // The GpuChannelManager destroy all the GpuChannels that they own when they | 165 // The GpuChannelManager destroy all the GpuChannels that they own when they |
| 161 // are destroyed. So a raw pointer is safe. | 166 // are destroyed. So a raw pointer is safe. |
| 162 GpuChannelManager* gpu_channel_manager_; | 167 GpuChannelManager* gpu_channel_manager_; |
| 163 | 168 |
| 169 gpu::gles2::ProgramCache* program_cache_; |
| 170 |
| 164 scoped_ptr<IPC::SyncChannel> channel_; | 171 scoped_ptr<IPC::SyncChannel> channel_; |
| 165 | 172 |
| 166 // Number of routed messages for pending processing on a stub. | 173 // Number of routed messages for pending processing on a stub. |
| 167 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; | 174 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; |
| 168 | 175 |
| 169 // If non-NULL, all stubs on this channel should stop processing GL | 176 // If non-NULL, all stubs on this channel should stop processing GL |
| 170 // commands (via their GpuScheduler) when preempt_by_counter_->count | 177 // commands (via their GpuScheduler) when preempt_by_counter_->count |
| 171 // is non-zero. | 178 // is non-zero. |
| 172 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; | 179 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; |
| 173 | 180 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 203 #if defined(OS_ANDROID) | 210 #if defined(OS_ANDROID) |
| 204 scoped_ptr<content::StreamTextureManagerAndroid> stream_texture_manager_; | 211 scoped_ptr<content::StreamTextureManagerAndroid> stream_texture_manager_; |
| 205 #endif | 212 #endif |
| 206 | 213 |
| 207 base::WeakPtrFactory<GpuChannel> weak_factory_; | 214 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 208 | 215 |
| 209 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 216 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 210 }; | 217 }; |
| 211 | 218 |
| 212 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 219 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |