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