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 "build/build_config.h" | 17 #include "build/build_config.h" |
17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
18 #include "content/common/content_param_traits.h" | 19 #include "content/common/content_param_traits.h" |
19 #include "content/common/gpu/gpu_memory_manager.h" | 20 #include "content/common/gpu/gpu_memory_manager.h" |
20 #include "ipc/ipc_listener.h" | 21 #include "ipc/ipc_listener.h" |
21 #include "ipc/ipc_sender.h" | 22 #include "ipc/ipc_sender.h" |
22 #include "ui/gfx/gpu_memory_buffer.h" | 23 #include "ui/gfx/gpu_memory_buffer.h" |
23 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
24 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
25 | 26 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 class MessageRouter; | 58 class MessageRouter; |
58 | 59 |
59 // A GpuChannelManager is a thread responsible for issuing rendering commands | 60 // A GpuChannelManager is a thread responsible for issuing rendering commands |
60 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 61 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
61 // browser process to them based on the corresponding renderer ID. | 62 // browser process to them based on the corresponding renderer ID. |
62 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, | 63 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
63 public IPC::Sender { | 64 public IPC::Sender { |
64 public: | 65 public: |
65 GpuChannelManager(MessageRouter* router, | 66 GpuChannelManager(MessageRouter* router, |
66 GpuWatchdog* watchdog, | 67 GpuWatchdog* watchdog, |
67 base::SingleThreadTaskRunner* io_task_runner, | 68 base::MessageLoopProxy* io_message_loop, |
68 base::WaitableEvent* shutdown_event, | 69 base::WaitableEvent* shutdown_event, |
69 IPC::SyncChannel* channel); | 70 IPC::SyncChannel* channel); |
70 ~GpuChannelManager() override; | 71 ~GpuChannelManager() override; |
71 | 72 |
72 // Remove the channel for a particular renderer. | 73 // Remove the channel for a particular renderer. |
73 void RemoveChannel(int client_id); | 74 void RemoveChannel(int client_id); |
74 | 75 |
75 // Listener overrides. | 76 // Listener overrides. |
76 bool OnMessageReceived(const IPC::Message& msg) override; | 77 bool OnMessageReceived(const IPC::Message& msg) override; |
77 | 78 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void OnRelinquishResources(); | 131 void OnRelinquishResources(); |
131 void OnResourcesRelinquished(); | 132 void OnResourcesRelinquished(); |
132 | 133 |
133 void OnUpdateValueState(int client_id, | 134 void OnUpdateValueState(int client_id, |
134 unsigned int target, | 135 unsigned int target, |
135 const gpu::ValueState& state); | 136 const gpu::ValueState& state); |
136 | 137 |
137 void OnLoseAllContexts(); | 138 void OnLoseAllContexts(); |
138 void CheckRelinquishGpuResources(); | 139 void CheckRelinquishGpuResources(); |
139 | 140 |
140 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 141 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
141 base::WaitableEvent* shutdown_event_; | 142 base::WaitableEvent* shutdown_event_; |
142 | 143 |
143 // Used to send and receive IPC messages from the browser process. | 144 // Used to send and receive IPC messages from the browser process. |
144 MessageRouter* const router_; | 145 MessageRouter* const router_; |
145 | 146 |
146 // These objects manage channels to individual renderer processes there is | 147 // These objects manage channels to individual renderer processes there is |
147 // one channel for each renderer process that has connected to this GPU | 148 // one channel for each renderer process that has connected to this GPU |
148 // process. | 149 // process. |
149 GpuChannelMap gpu_channels_; | 150 GpuChannelMap gpu_channels_; |
150 scoped_refptr<gfx::GLShareGroup> share_group_; | 151 scoped_refptr<gfx::GLShareGroup> share_group_; |
(...skipping 13 matching lines...) Expand all Loading... |
164 // that any WeakPtrs to Controller are invalidated before its members | 165 // that any WeakPtrs to Controller are invalidated before its members |
165 // variable's destructors are executed, rendering them invalid. | 166 // variable's destructors are executed, rendering them invalid. |
166 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 167 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
167 | 168 |
168 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 169 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
169 }; | 170 }; |
170 | 171 |
171 } // namespace content | 172 } // namespace content |
172 | 173 |
173 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 174 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |