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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/gpu/gpu_memory_manager.h" | 14 #include "content/common/gpu/gpu_memory_manager.h" |
15 #include "ipc/ipc_channel.h" | 15 #include "ipc/ipc_channel.h" |
16 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class WaitableEvent; | 20 class WaitableEvent; |
21 } | 21 } |
22 | 22 |
| 23 namespace gfx { |
| 24 class GLShareGroup; |
| 25 } |
| 26 |
23 namespace IPC { | 27 namespace IPC { |
24 struct ChannelHandle; | 28 struct ChannelHandle; |
25 } | 29 } |
26 | 30 |
27 class ChildThread; | 31 class ChildThread; |
28 class GpuChannel; | 32 class GpuChannel; |
29 class GpuWatchdog; | 33 class GpuWatchdog; |
30 struct GPUCreateCommandBufferConfig; | 34 struct GPUCreateCommandBufferConfig; |
31 | 35 |
32 // A GpuChannelManager is a thread responsible for issuing rendering commands | 36 // A GpuChannelManager is a thread responsible for issuing rendering commands |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 int GenerateRouteID(); | 73 int GenerateRouteID(); |
70 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 74 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
71 void RemoveRoute(int32 routing_id); | 75 void RemoveRoute(int32 routing_id); |
72 | 76 |
73 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } | 77 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } |
74 | 78 |
75 GpuChannel* LookupChannel(int32 client_id); | 79 GpuChannel* LookupChannel(int32 client_id); |
76 | 80 |
77 private: | 81 private: |
78 // Message handlers. | 82 // Message handlers. |
79 void OnEstablishChannel(int client_id, int share_client_id); | 83 void OnEstablishChannel(int client_id, bool share_context); |
80 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 84 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
81 void OnVisibilityChanged( | 85 void OnVisibilityChanged( |
82 int32 render_view_id, int32 client_id, bool visible); | 86 int32 render_view_id, int32 client_id, bool visible); |
83 void OnCreateViewCommandBuffer( | 87 void OnCreateViewCommandBuffer( |
84 const gfx::GLSurfaceHandle& window, | 88 const gfx::GLSurfaceHandle& window, |
85 int32 render_view_id, | 89 int32 render_view_id, |
86 int32 client_id, | 90 int32 client_id, |
87 const GPUCreateCommandBufferConfig& init_params); | 91 const GPUCreateCommandBufferConfig& init_params); |
88 | 92 |
89 void OnLoseAllContexts(); | 93 void OnLoseAllContexts(); |
90 | 94 |
91 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 95 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
92 base::WaitableEvent* shutdown_event_; | 96 base::WaitableEvent* shutdown_event_; |
93 | 97 |
94 // Used to send and receive IPC messages from the browser process. | 98 // Used to send and receive IPC messages from the browser process. |
95 ChildThread* gpu_child_thread_; | 99 ChildThread* gpu_child_thread_; |
96 | 100 |
97 // These objects manage channels to individual renderer processes there is | 101 // These objects manage channels to individual renderer processes there is |
98 // one channel for each renderer process that has connected to this GPU | 102 // one channel for each renderer process that has connected to this GPU |
99 // process. | 103 // process. |
100 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | 104 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
101 GpuChannelMap gpu_channels_; | 105 GpuChannelMap gpu_channels_; |
| 106 scoped_refptr<gfx::GLShareGroup> share_group_; |
102 GpuMemoryManager gpu_memory_manager_; | 107 GpuMemoryManager gpu_memory_manager_; |
103 GpuWatchdog* watchdog_; | 108 GpuWatchdog* watchdog_; |
104 | 109 |
105 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 110 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
106 }; | 111 }; |
107 | 112 |
108 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 113 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |