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 <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop_proxy.h" | 15 #include "base/message_loop_proxy.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "content/common/gpu/gpu_memory_manager.h" | 17 #include "content/common/gpu/gpu_memory_manager.h" |
17 #include "ipc/ipc_listener.h" | 18 #include "ipc/ipc_listener.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 | 90 |
90 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } | 91 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } |
91 | 92 |
92 GpuChannel* LookupChannel(int32 client_id); | 93 GpuChannel* LookupChannel(int32 client_id); |
93 | 94 |
94 SyncPointManager* sync_point_manager() { return sync_point_manager_; } | 95 SyncPointManager* sync_point_manager() { return sync_point_manager_; } |
95 | 96 |
96 gfx::GLSurface* GetDefaultOffscreenSurface(); | 97 gfx::GLSurface* GetDefaultOffscreenSurface(); |
97 | 98 |
98 private: | 99 private: |
100 typedef std::pair<int32, base::Closure> ImageOperation; | |
piman
2012/10/17 17:46:20
nit: we usually avoid std::pair except for implici
| |
101 | |
99 // Message handlers. | 102 // Message handlers. |
100 void OnEstablishChannel(int client_id, bool share_context); | 103 void OnEstablishChannel(int client_id, bool share_context); |
101 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 104 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
102 void OnVisibilityChanged( | 105 void OnVisibilityChanged( |
103 int32 render_view_id, int32 client_id, bool visible); | 106 int32 render_view_id, int32 client_id, bool visible); |
104 void OnCreateViewCommandBuffer( | 107 void OnCreateViewCommandBuffer( |
105 const gfx::GLSurfaceHandle& window, | 108 const gfx::GLSurfaceHandle& window, |
106 int32 render_view_id, | 109 int32 render_view_id, |
107 int32 client_id, | 110 int32 client_id, |
108 const GPUCreateCommandBufferConfig& init_params); | 111 const GPUCreateCommandBufferConfig& init_params); |
112 void CreateImage( | |
113 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); | |
114 void OnCreateImage( | |
115 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); | |
116 void DeleteImage(int32 client_id, int32 image_id); | |
117 void OnDeleteImage(int32 client_id, int32 image_id, int32 sync_point); | |
118 void OnDeleteImageSyncPointRetired(ImageOperation*); | |
109 | 119 |
110 void OnLoseAllContexts(); | 120 void OnLoseAllContexts(); |
111 | 121 |
112 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 122 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
113 base::WaitableEvent* shutdown_event_; | 123 base::WaitableEvent* shutdown_event_; |
114 | 124 |
115 // Used to send and receive IPC messages from the browser process. | 125 // Used to send and receive IPC messages from the browser process. |
116 ChildThread* gpu_child_thread_; | 126 ChildThread* gpu_child_thread_; |
117 | 127 |
118 // These objects manage channels to individual renderer processes there is | 128 // These objects manage channels to individual renderer processes there is |
119 // one channel for each renderer process that has connected to this GPU | 129 // one channel for each renderer process that has connected to this GPU |
120 // process. | 130 // process. |
121 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | 131 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
122 GpuChannelMap gpu_channels_; | 132 GpuChannelMap gpu_channels_; |
123 scoped_refptr<gfx::GLShareGroup> share_group_; | 133 scoped_refptr<gfx::GLShareGroup> share_group_; |
124 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 134 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
125 GpuMemoryManager gpu_memory_manager_; | 135 GpuMemoryManager gpu_memory_manager_; |
126 GpuWatchdog* watchdog_; | 136 GpuWatchdog* watchdog_; |
127 scoped_refptr<SyncPointManager> sync_point_manager_; | 137 scoped_refptr<SyncPointManager> sync_point_manager_; |
128 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 138 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
129 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 139 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
140 typedef std::deque<ImageOperation> ImageOperationQueue; | |
piman
2012/10/17 17:46:20
nit: typedefs usually go together at the top of th
| |
141 ImageOperationQueue image_operations_; | |
130 | 142 |
131 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 143 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
132 }; | 144 }; |
133 | 145 |
134 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 146 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |