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_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 26 matching lines...) Expand all Loading... |
37 union ValueState; | 37 union ValueState; |
38 namespace gles2 { | 38 namespace gles2 { |
39 class FramebufferCompletenessCache; | 39 class FramebufferCompletenessCache; |
40 class MailboxManager; | 40 class MailboxManager; |
41 class ProgramCache; | 41 class ProgramCache; |
42 class ShaderTranslatorCache; | 42 class ShaderTranslatorCache; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 namespace IPC { | 46 namespace IPC { |
47 class AttachmentBroker; | |
48 struct ChannelHandle; | 47 struct ChannelHandle; |
49 class SyncChannel; | 48 class SyncChannel; |
50 } | 49 } |
51 | 50 |
52 struct GPUCreateCommandBufferConfig; | 51 struct GPUCreateCommandBufferConfig; |
53 | 52 |
54 namespace content { | 53 namespace content { |
55 class GpuChannel; | 54 class GpuChannel; |
56 class GpuMemoryBufferFactory; | 55 class GpuMemoryBufferFactory; |
57 class GpuWatchdog; | 56 class GpuWatchdog; |
58 | 57 |
59 // A GpuChannelManager is a thread responsible for issuing rendering commands | 58 // A GpuChannelManager is a thread responsible for issuing rendering commands |
60 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 59 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
61 // browser process to them based on the corresponding renderer ID. | 60 // browser process to them based on the corresponding renderer ID. |
62 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, | 61 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
63 public IPC::Sender { | 62 public IPC::Sender { |
64 public: | 63 public: |
65 // |broker| must outlive GpuChannelManager and any channels it creates. | |
66 GpuChannelManager(IPC::SyncChannel* channel, | 64 GpuChannelManager(IPC::SyncChannel* channel, |
67 GpuWatchdog* watchdog, | 65 GpuWatchdog* watchdog, |
68 base::SingleThreadTaskRunner* task_runner, | 66 base::SingleThreadTaskRunner* task_runner, |
69 base::SingleThreadTaskRunner* io_task_runner, | 67 base::SingleThreadTaskRunner* io_task_runner, |
70 base::WaitableEvent* shutdown_event, | 68 base::WaitableEvent* shutdown_event, |
71 IPC::AttachmentBroker* broker, | |
72 gpu::SyncPointManager* sync_point_manager, | 69 gpu::SyncPointManager* sync_point_manager, |
73 GpuMemoryBufferFactory* gpu_memory_buffer_factory); | 70 GpuMemoryBufferFactory* gpu_memory_buffer_factory); |
74 ~GpuChannelManager() override; | 71 ~GpuChannelManager() override; |
75 | 72 |
76 // Remove the channel for a particular renderer. | 73 // Remove the channel for a particular renderer. |
77 void RemoveChannel(int client_id); | 74 void RemoveChannel(int client_id); |
78 | 75 |
79 // Listener overrides. | 76 // Listener overrides. |
80 bool OnMessageReceived(const IPC::Message& msg) override; | 77 bool OnMessageReceived(const IPC::Message& msg) override; |
81 | 78 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 162 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
166 GpuMemoryManager gpu_memory_manager_; | 163 GpuMemoryManager gpu_memory_manager_; |
167 // SyncPointManager guaranteed to outlive running MessageLoop. | 164 // SyncPointManager guaranteed to outlive running MessageLoop. |
168 gpu::SyncPointManager* sync_point_manager_; | 165 gpu::SyncPointManager* sync_point_manager_; |
169 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 166 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
170 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 167 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
171 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 168 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
172 framebuffer_completeness_cache_; | 169 framebuffer_completeness_cache_; |
173 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 170 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
174 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 171 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
175 // Must outlive this instance of GpuChannelManager. | |
176 IPC::AttachmentBroker* attachment_broker_; | |
177 | 172 |
178 // Member variables should appear before the WeakPtrFactory, to ensure | 173 // Member variables should appear before the WeakPtrFactory, to ensure |
179 // that any WeakPtrs to Controller are invalidated before its members | 174 // that any WeakPtrs to Controller are invalidated before its members |
180 // variable's destructors are executed, rendering them invalid. | 175 // variable's destructors are executed, rendering them invalid. |
181 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 176 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
182 | 177 |
183 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 178 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
184 }; | 179 }; |
185 | 180 |
186 } // namespace content | 181 } // namespace content |
187 | 182 |
188 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 183 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |