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