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> |
11 | 11 |
12 #include "base/containers/scoped_ptr_hash_map.h" | 12 #include "base/containers/scoped_ptr_hash_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/message_loop/message_loop_proxy.h" | 16 #include "base/message_loop/message_loop_proxy.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/common/content_param_traits.h" | 19 #include "content/common/content_param_traits.h" |
20 #include "content/common/gpu/devtools_gpu_instrumentation.h" | 20 #include "content/common/gpu/devtools_gpu_instrumentation.h" |
21 #include "content/common/gpu/gpu_memory_manager.h" | 21 #include "content/common/gpu/gpu_memory_manager.h" |
22 #include "gpu/command_buffer/service/valuebuffer_manager.h" | |
22 #include "ipc/ipc_listener.h" | 23 #include "ipc/ipc_listener.h" |
23 #include "ipc/ipc_sender.h" | 24 #include "ipc/ipc_sender.h" |
24 #include "ui/gfx/gpu_memory_buffer.h" | 25 #include "ui/gfx/gpu_memory_buffer.h" |
25 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
26 #include "ui/gl/gl_surface.h" | 27 #include "ui/gl/gl_surface.h" |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 class WaitableEvent; | 30 class WaitableEvent; |
30 } | 31 } |
31 | 32 |
(...skipping 23 matching lines...) Expand all Loading... | |
55 namespace content { | 56 namespace content { |
56 class GpuChannel; | 57 class GpuChannel; |
57 class GpuMemoryBufferFactory; | 58 class GpuMemoryBufferFactory; |
58 class GpuWatchdog; | 59 class GpuWatchdog; |
59 class MessageRouter; | 60 class MessageRouter; |
60 | 61 |
61 // A GpuChannelManager is a thread responsible for issuing rendering commands | 62 // A GpuChannelManager is a thread responsible for issuing rendering commands |
62 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 63 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
63 // browser process to them based on the corresponding renderer ID. | 64 // browser process to them based on the corresponding renderer ID. |
64 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, | 65 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
65 public IPC::Sender { | 66 public IPC::Sender, |
67 public gpu::gles2::SubscriptionRefSet::Observer { | |
66 public: | 68 public: |
67 GpuChannelManager(MessageRouter* router, | 69 GpuChannelManager(MessageRouter* router, |
68 GpuWatchdog* watchdog, | 70 GpuWatchdog* watchdog, |
69 base::MessageLoopProxy* io_message_loop, | 71 base::MessageLoopProxy* io_message_loop, |
70 base::WaitableEvent* shutdown_event, | 72 base::WaitableEvent* shutdown_event, |
71 IPC::SyncChannel* channel); | 73 IPC::SyncChannel* channel); |
72 ~GpuChannelManager() override; | 74 ~GpuChannelManager() override; |
73 | 75 |
74 // Remove the channel for a particular renderer. | 76 // Remove the channel for a particular renderer. |
75 void RemoveChannel(int client_id); | 77 void RemoveChannel(int client_id); |
76 | 78 |
77 // Listener overrides. | 79 // Listener overrides. |
78 bool OnMessageReceived(const IPC::Message& msg) override; | 80 bool OnMessageReceived(const IPC::Message& msg) override; |
79 | 81 |
80 // Sender overrides. | 82 // Sender overrides. |
81 bool Send(IPC::Message* msg) override; | 83 bool Send(IPC::Message* msg) override; |
82 | 84 |
85 // SubscriptionRefSet::Observer overrides | |
86 void OnAddSubscription(unsigned int target) override; | |
87 void OnRemoveSubscription(unsigned int target) override; | |
88 | |
83 bool HandleMessagesScheduled(); | 89 bool HandleMessagesScheduled(); |
84 uint64 MessagesProcessed(); | 90 uint64 MessagesProcessed(); |
85 | 91 |
86 void LoseAllContexts(); | 92 void LoseAllContexts(); |
87 | 93 |
88 int GenerateRouteID(); | 94 int GenerateRouteID(); |
89 void AddRoute(int32 routing_id, IPC::Listener* listener); | 95 void AddRoute(int32 routing_id, IPC::Listener* listener); |
90 void RemoveRoute(int32 routing_id); | 96 void RemoveRoute(int32 routing_id); |
91 | 97 |
92 gpu::gles2::ProgramCache* program_cache(); | 98 gpu::gles2::ProgramCache* program_cache(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 GpuMemoryManager gpu_memory_manager_; | 163 GpuMemoryManager gpu_memory_manager_; |
158 GpuEventsDispatcher gpu_devtools_events_dispatcher_; | 164 GpuEventsDispatcher gpu_devtools_events_dispatcher_; |
159 GpuWatchdog* watchdog_; | 165 GpuWatchdog* watchdog_; |
160 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; | 166 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; |
161 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 167 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
162 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 168 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
163 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 169 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
164 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 170 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
165 IPC::SyncChannel* channel_; | 171 IPC::SyncChannel* channel_; |
166 scoped_refptr<IPC::MessageFilter> filter_; | 172 scoped_refptr<IPC::MessageFilter> filter_; |
173 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; | |
piman
2014/12/05 21:04:36
Do we want a global one for all channels, or one p
orglofch
2014/12/06 21:49:04
Done.
| |
167 | 174 |
168 // Member variables should appear before the WeakPtrFactory, to ensure | 175 // Member variables should appear before the WeakPtrFactory, to ensure |
169 // that any WeakPtrs to Controller are invalidated before its members | 176 // that any WeakPtrs to Controller are invalidated before its members |
170 // variable's destructors are executed, rendering them invalid. | 177 // variable's destructors are executed, rendering them invalid. |
171 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 178 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
172 | 179 |
173 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 180 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
174 }; | 181 }; |
175 | 182 |
176 } // namespace content | 183 } // namespace content |
177 | 184 |
178 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 185 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |