| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 struct GPUCreateCommandBufferConfig; | 28 struct GPUCreateCommandBufferConfig; |
| 29 class GpuWatchdog; | 29 class GpuWatchdog; |
| 30 | 30 |
| 31 namespace base { | 31 namespace base { |
| 32 class MessageLoopProxy; | 32 class MessageLoopProxy; |
| 33 class WaitableEvent; | 33 class WaitableEvent; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace gpu { | 36 namespace gpu { |
| 37 struct RefCountedCounter; | 37 struct RefCountedCounter; |
| 38 namespace gles2 { |
| 39 class ProgramCache; |
| 40 } |
| 38 } | 41 } |
| 39 | 42 |
| 40 // Encapsulates an IPC channel between the GPU process and one renderer | 43 // Encapsulates an IPC channel between the GPU process and one renderer |
| 41 // process. On the renderer side there's a corresponding GpuChannelHost. | 44 // process. On the renderer side there's a corresponding GpuChannelHost. |
| 42 class GpuChannel : public IPC::Listener, | 45 class GpuChannel : public IPC::Listener, |
| 43 public IPC::Sender, | 46 public IPC::Sender, |
| 44 public base::RefCountedThreadSafe<GpuChannel> { | 47 public base::RefCountedThreadSafe<GpuChannel> { |
| 45 public: | 48 public: |
| 46 // Takes ownership of the renderer process handle. | 49 // Takes ownership of the renderer process handle. |
| 47 GpuChannel(GpuChannelManager* gpu_channel_manager, | 50 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 48 GpuWatchdog* watchdog, | 51 GpuWatchdog* watchdog, |
| 49 gfx::GLShareGroup* share_group, | 52 gfx::GLShareGroup* share_group, |
| 50 gpu::gles2::MailboxManager* mailbox_manager, | 53 gpu::gles2::MailboxManager* mailbox_manager, |
| 51 int client_id, | 54 int client_id, |
| 52 bool software); | 55 bool software, |
| 56 gpu::gles2::ProgramCache* program_cache); |
| 53 | 57 |
| 54 bool Init(base::MessageLoopProxy* io_message_loop, | 58 bool Init(base::MessageLoopProxy* io_message_loop, |
| 55 base::WaitableEvent* shutdown_event); | 59 base::WaitableEvent* shutdown_event); |
| 56 | 60 |
| 57 // Get the GpuChannelManager that owns this channel. | 61 // Get the GpuChannelManager that owns this channel. |
| 58 GpuChannelManager* gpu_channel_manager() const { | 62 GpuChannelManager* gpu_channel_manager() const { |
| 59 return gpu_channel_manager_; | 63 return gpu_channel_manager_; |
| 60 } | 64 } |
| 61 | 65 |
| 62 // Returns the name of the associated IPC channel. | 66 // Returns the name of the associated IPC channel. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 const gfx::Size& size, | 138 const gfx::Size& size, |
| 135 const GPUCreateCommandBufferConfig& init_params, | 139 const GPUCreateCommandBufferConfig& init_params, |
| 136 IPC::Message* reply_message); | 140 IPC::Message* reply_message); |
| 137 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); | 141 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); |
| 138 | 142 |
| 139 // The lifetime of objects of this class is managed by a GpuChannelManager. | 143 // The lifetime of objects of this class is managed by a GpuChannelManager. |
| 140 // The GpuChannelManager destroy all the GpuChannels that they own when they | 144 // The GpuChannelManager destroy all the GpuChannels that they own when they |
| 141 // are destroyed. So a raw pointer is safe. | 145 // are destroyed. So a raw pointer is safe. |
| 142 GpuChannelManager* gpu_channel_manager_; | 146 GpuChannelManager* gpu_channel_manager_; |
| 143 | 147 |
| 148 gpu::gles2::ProgramCache* program_cache_; |
| 149 |
| 144 scoped_ptr<IPC::SyncChannel> channel_; | 150 scoped_ptr<IPC::SyncChannel> channel_; |
| 145 | 151 |
| 146 // Number of routed messages for pending processing on a stub. | 152 // Number of routed messages for pending processing on a stub. |
| 147 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; | 153 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; |
| 148 | 154 |
| 149 // If non-NULL, all stubs on this channel should stop processing GL | 155 // If non-NULL, all stubs on this channel should stop processing GL |
| 150 // commands (via their GpuScheduler) when preempt_by_counter_->count | 156 // commands (via their GpuScheduler) when preempt_by_counter_->count |
| 151 // is non-zero. | 157 // is non-zero. |
| 152 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; | 158 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; |
| 153 | 159 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 179 bool software_; | 185 bool software_; |
| 180 bool handle_messages_scheduled_; | 186 bool handle_messages_scheduled_; |
| 181 bool processed_get_state_fast_; | 187 bool processed_get_state_fast_; |
| 182 | 188 |
| 183 base::WeakPtrFactory<GpuChannel> weak_factory_; | 189 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 184 | 190 |
| 185 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 191 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 186 }; | 192 }; |
| 187 | 193 |
| 188 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 194 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |