Chromium Code Reviews| 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 class ShaderCache; | |
|
greggman
2012/06/15 08:10:24
Should these be named ProgramCache and MemoryProgr
dmurph
2012/06/19 01:08:33
Done.
| |
| 38 } | 39 } |
| 39 | 40 |
| 40 // Encapsulates an IPC channel between the GPU process and one renderer | 41 // Encapsulates an IPC channel between the GPU process and one renderer |
| 41 // process. On the renderer side there's a corresponding GpuChannelHost. | 42 // process. On the renderer side there's a corresponding GpuChannelHost. |
| 42 class GpuChannel : public IPC::Channel::Listener, | 43 class GpuChannel : public IPC::Channel::Listener, |
| 43 public IPC::Message::Sender, | 44 public IPC::Message::Sender, |
| 44 public base::RefCountedThreadSafe<GpuChannel> { | 45 public base::RefCountedThreadSafe<GpuChannel> { |
| 45 public: | 46 public: |
| 46 // Takes ownership of the renderer process handle. | 47 // Takes ownership of the renderer process handle. |
| 47 GpuChannel(GpuChannelManager* gpu_channel_manager, | 48 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 48 GpuWatchdog* watchdog, | 49 GpuWatchdog* watchdog, |
| 49 gfx::GLShareGroup* share_group, | 50 gfx::GLShareGroup* share_group, |
| 50 gpu::gles2::MailboxManager* mailbox_manager, | 51 gpu::gles2::MailboxManager* mailbox_manager, |
| 51 int client_id, | 52 int client_id, |
| 52 bool software); | 53 bool software, |
| 54 base::WeakPtr<gpu::ShaderCache> shader_cache); | |
| 53 | 55 |
| 54 bool Init(base::MessageLoopProxy* io_message_loop, | 56 bool Init(base::MessageLoopProxy* io_message_loop, |
| 55 base::WaitableEvent* shutdown_event); | 57 base::WaitableEvent* shutdown_event); |
| 56 | 58 |
| 57 // Get the GpuChannelManager that owns this channel. | 59 // Get the GpuChannelManager that owns this channel. |
| 58 GpuChannelManager* gpu_channel_manager() const { | 60 GpuChannelManager* gpu_channel_manager() const { |
| 59 return gpu_channel_manager_; | 61 return gpu_channel_manager_; |
| 60 } | 62 } |
| 61 | 63 |
| 62 // Returns the name of the associated IPC channel. | 64 // 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, | 136 const gfx::Size& size, |
| 135 const GPUCreateCommandBufferConfig& init_params, | 137 const GPUCreateCommandBufferConfig& init_params, |
| 136 IPC::Message* reply_message); | 138 IPC::Message* reply_message); |
| 137 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); | 139 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); |
| 138 | 140 |
| 139 // The lifetime of objects of this class is managed by a GpuChannelManager. | 141 // The lifetime of objects of this class is managed by a GpuChannelManager. |
| 140 // The GpuChannelManager destroy all the GpuChannels that they own when they | 142 // The GpuChannelManager destroy all the GpuChannels that they own when they |
| 141 // are destroyed. So a raw pointer is safe. | 143 // are destroyed. So a raw pointer is safe. |
| 142 GpuChannelManager* gpu_channel_manager_; | 144 GpuChannelManager* gpu_channel_manager_; |
| 143 | 145 |
| 146 base::WeakPtr<gpu::ShaderCache> shader_cache_; | |
|
greggman
2012/06/15 08:10:24
Does this really need to be a weak ptr? Usually we
dmurph
2012/06/15 16:40:23
Yes, but I would argue that it's
1. Better design,
| |
| 147 | |
| 144 scoped_ptr<IPC::SyncChannel> channel_; | 148 scoped_ptr<IPC::SyncChannel> channel_; |
| 145 | 149 |
| 146 // Number of routed messages for pending processing on a stub. | 150 // Number of routed messages for pending processing on a stub. |
| 147 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; | 151 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; |
| 148 | 152 |
| 149 // If non-NULL, all stubs on this channel should stop processing GL | 153 // If non-NULL, all stubs on this channel should stop processing GL |
| 150 // commands (via their GpuScheduler) when preempt_by_counter_->count | 154 // commands (via their GpuScheduler) when preempt_by_counter_->count |
| 151 // is non-zero. | 155 // is non-zero. |
| 152 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; | 156 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; |
| 153 | 157 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 179 bool software_; | 183 bool software_; |
| 180 bool handle_messages_scheduled_; | 184 bool handle_messages_scheduled_; |
| 181 bool processed_get_state_fast_; | 185 bool processed_get_state_fast_; |
| 182 | 186 |
| 183 base::WeakPtrFactory<GpuChannel> weak_factory_; | 187 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 184 | 188 |
| 185 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 189 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 186 }; | 190 }; |
| 187 | 191 |
| 188 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 192 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |