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> |
| 11 | 11 |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process.h" | 16 #include "base/process.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/common/gpu/gpu_command_buffer_stub.h" | 18 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 19 #include "content/common/gpu/gpu_memory_manager.h" | |
| 19 #include "content/common/message_router.h" | 20 #include "content/common/message_router.h" |
| 20 #include "ipc/ipc_sync_channel.h" | 21 #include "ipc/ipc_sync_channel.h" |
| 21 #include "ui/gfx/gl/gl_share_group.h" | 22 #include "ui/gfx/gl/gl_share_group.h" |
| 22 #include "ui/gfx/gl/gpu_preference.h" | 23 #include "ui/gfx/gl/gpu_preference.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
| 24 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
| 25 | 26 |
| 26 class GpuChannelManager; | 27 class GpuChannelManager; |
| 27 struct GPUCreateCommandBufferConfig; | 28 struct GPUCreateCommandBufferConfig; |
| 28 class GpuWatchdog; | 29 class GpuWatchdog; |
| 29 | 30 |
| 30 namespace base { | 31 namespace base { |
| 31 class MessageLoopProxy; | 32 class MessageLoopProxy; |
| 32 class WaitableEvent; | 33 class WaitableEvent; |
| 33 } | 34 } |
| 34 | 35 |
| 35 // Encapsulates an IPC channel between the GPU process and one renderer | 36 // Encapsulates an IPC channel between the GPU process and one renderer |
| 36 // process. On the renderer side there's a corresponding GpuChannelHost. | 37 // process. On the renderer side there's a corresponding GpuChannelHost. |
| 37 class GpuChannel : public IPC::Channel::Listener, | 38 class GpuChannel : public IPC::Channel::Listener, |
| 38 public IPC::Message::Sender, | 39 public IPC::Message::Sender, |
| 40 public GpuMemoryManagerClient, | |
|
jonathan.backer
2012/01/31 18:13:58
Necessary?
mmocny
2012/01/31 18:54:57
Indeed, no.
On 2012/01/31 18:13:58, jonathan.backe
| |
| 39 public base::RefCountedThreadSafe<GpuChannel> { | 41 public base::RefCountedThreadSafe<GpuChannel> { |
| 40 public: | 42 public: |
| 41 // Takes ownership of the renderer process handle. | 43 // Takes ownership of the renderer process handle. |
| 42 GpuChannel(GpuChannelManager* gpu_channel_manager, | 44 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 43 GpuWatchdog* watchdog, | 45 GpuWatchdog* watchdog, |
| 44 gfx::GLShareGroup* share_group, | 46 gfx::GLShareGroup* share_group, |
| 45 int client_id, | 47 int client_id, |
| 46 bool software); | 48 bool software); |
| 47 virtual ~GpuChannel(); | 49 virtual ~GpuChannel(); |
| 48 | 50 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 66 } | 68 } |
| 67 | 69 |
| 68 // IPC::Channel::Listener implementation: | 70 // IPC::Channel::Listener implementation: |
| 69 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 71 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 70 virtual void OnChannelError() OVERRIDE; | 72 virtual void OnChannelError() OVERRIDE; |
| 71 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 73 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 72 | 74 |
| 73 // IPC::Message::Sender implementation: | 75 // IPC::Message::Sender implementation: |
| 74 virtual bool Send(IPC::Message* msg) OVERRIDE; | 76 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 75 | 77 |
| 78 // GpuMemoryManagerClient implementation: | |
| 79 virtual void AppendAllCommandBufferStubs( | |
|
nduca
2012/01/31 06:53:47
Overkill. Just append them all. Then filter then a
mmocny
2012/01/31 18:54:57
Done.
| |
| 80 std::vector<GpuMemoryManageableCommandBufferStub*>& stubs_with_surface, | |
| 81 std::vector<GpuMemoryManageableCommandBufferStub*>& stubs_without_surface) | |
| 82 OVERRIDE; | |
| 83 | |
| 76 // Whether this channel is able to handle IPC messages. | 84 // Whether this channel is able to handle IPC messages. |
| 77 bool IsScheduled(); | 85 bool IsScheduled(); |
| 78 | 86 |
| 79 // This is called when a command buffer transitions from the unscheduled | 87 // This is called when a command buffer transitions from the unscheduled |
| 80 // state to the scheduled state, which potentially means the channel | 88 // state to the scheduled state, which potentially means the channel |
| 81 // transitions from the unscheduled to the scheduled state. When this occurs | 89 // transitions from the unscheduled to the scheduled state. When this occurs |
| 82 // deferred IPC messaged are handled. | 90 // deferred IPC messaged are handled. |
| 83 void OnScheduled(); | 91 void OnScheduled(); |
| 84 | 92 |
| 85 void CreateViewCommandBuffer( | 93 void CreateViewCommandBuffer( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 bool handle_messages_scheduled_; | 181 bool handle_messages_scheduled_; |
| 174 bool processed_get_state_fast_; | 182 bool processed_get_state_fast_; |
| 175 int32 num_contexts_preferring_discrete_gpu_; | 183 int32 num_contexts_preferring_discrete_gpu_; |
| 176 | 184 |
| 177 base::WeakPtrFactory<GpuChannel> weak_factory_; | 185 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 178 | 186 |
| 179 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 187 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 180 }; | 188 }; |
| 181 | 189 |
| 182 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 190 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |