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 } | 37 } |
38 } | 38 } |
39 | 39 |
40 namespace IPC { | 40 namespace IPC { |
41 struct ChannelHandle; | 41 struct ChannelHandle; |
42 } | 42 } |
43 | 43 |
44 struct GPUCreateCommandBufferConfig; | 44 struct GPUCreateCommandBufferConfig; |
45 | 45 |
46 namespace content { | 46 namespace content { |
47 class ChildThread; | |
48 class GpuChannel; | 47 class GpuChannel; |
49 class GpuWatchdog; | 48 class GpuWatchdog; |
| 49 class MessageRouter; |
50 class SyncPointManager; | 50 class SyncPointManager; |
51 | 51 |
52 // A GpuChannelManager is a thread responsible for issuing rendering commands | 52 // A GpuChannelManager is a thread responsible for issuing rendering commands |
53 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 53 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
54 // browser process to them based on the corresponding renderer ID. | 54 // browser process to them based on the corresponding renderer ID. |
55 // | |
56 // A GpuChannelManager can also be hosted in the browser process in single | |
57 // process or in-process GPU modes. In this case there is no corresponding | |
58 // GpuChildThread and this is the reason the GpuChildThread is referenced via | |
59 // a pointer to IPC::Sender, which can be implemented by other hosts to send | |
60 // IPC messages to the browser process IO thread on the GpuChannelManager's | |
61 // behalf. | |
62 class GpuChannelManager : public IPC::Listener, | 55 class GpuChannelManager : public IPC::Listener, |
63 public IPC::Sender { | 56 public IPC::Sender { |
64 public: | 57 public: |
65 GpuChannelManager(ChildThread* gpu_child_thread, | 58 GpuChannelManager(MessageRouter* router, |
66 GpuWatchdog* watchdog, | 59 GpuWatchdog* watchdog, |
67 base::MessageLoopProxy* io_message_loop, | 60 base::MessageLoopProxy* io_message_loop, |
68 base::WaitableEvent* shutdown_event); | 61 base::WaitableEvent* shutdown_event); |
69 virtual ~GpuChannelManager(); | 62 virtual ~GpuChannelManager(); |
70 | 63 |
71 // Remove the channel for a particular renderer. | 64 // Remove the channel for a particular renderer. |
72 void RemoveChannel(int client_id); | 65 void RemoveChannel(int client_id); |
73 | 66 |
74 // Listener overrides. | 67 // Listener overrides. |
75 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 68 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void OnDeleteImage(int32 client_id, int32 image_id, int32 sync_point); | 124 void OnDeleteImage(int32 client_id, int32 image_id, int32 sync_point); |
132 void OnDeleteImageSyncPointRetired(ImageOperation*); | 125 void OnDeleteImageSyncPointRetired(ImageOperation*); |
133 void OnLoadedShader(std::string shader); | 126 void OnLoadedShader(std::string shader); |
134 | 127 |
135 void OnLoseAllContexts(); | 128 void OnLoseAllContexts(); |
136 | 129 |
137 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 130 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
138 base::WaitableEvent* shutdown_event_; | 131 base::WaitableEvent* shutdown_event_; |
139 | 132 |
140 // Used to send and receive IPC messages from the browser process. | 133 // Used to send and receive IPC messages from the browser process. |
141 ChildThread* gpu_child_thread_; | 134 MessageRouter* const router_; |
142 | 135 |
143 // These objects manage channels to individual renderer processes there is | 136 // These objects manage channels to individual renderer processes there is |
144 // one channel for each renderer process that has connected to this GPU | 137 // one channel for each renderer process that has connected to this GPU |
145 // process. | 138 // process. |
146 GpuChannelMap gpu_channels_; | 139 GpuChannelMap gpu_channels_; |
147 scoped_refptr<gfx::GLShareGroup> share_group_; | 140 scoped_refptr<gfx::GLShareGroup> share_group_; |
148 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 141 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
149 GpuMemoryManager gpu_memory_manager_; | 142 GpuMemoryManager gpu_memory_manager_; |
150 GpuEventsDispatcher gpu_devtools_events_dispatcher_; | 143 GpuEventsDispatcher gpu_devtools_events_dispatcher_; |
151 GpuWatchdog* watchdog_; | 144 GpuWatchdog* watchdog_; |
152 scoped_refptr<SyncPointManager> sync_point_manager_; | 145 scoped_refptr<SyncPointManager> sync_point_manager_; |
153 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 146 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
154 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 147 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
155 ImageOperationQueue image_operations_; | 148 ImageOperationQueue image_operations_; |
156 | 149 |
157 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 150 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
158 }; | 151 }; |
159 | 152 |
160 } // namespace content | 153 } // namespace content |
161 | 154 |
162 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 155 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |