| 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 struct ImageOperation { |
| 101 ImageOperation(int32 sync_point, base::Closure callback); |
| 102 ~ImageOperation(); |
| 103 |
| 104 int32 sync_point; |
| 105 base::Closure callback; |
| 106 }; |
| 107 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
| 108 typedef std::deque<ImageOperation*> ImageOperationQueue; |
| 109 |
| 99 // Message handlers. | 110 // Message handlers. |
| 100 void OnEstablishChannel(int client_id, bool share_context); | 111 void OnEstablishChannel(int client_id, bool share_context); |
| 101 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 112 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
| 102 void OnVisibilityChanged( | 113 void OnVisibilityChanged( |
| 103 int32 render_view_id, int32 client_id, bool visible); | 114 int32 render_view_id, int32 client_id, bool visible); |
| 104 void OnCreateViewCommandBuffer( | 115 void OnCreateViewCommandBuffer( |
| 105 const gfx::GLSurfaceHandle& window, | 116 const gfx::GLSurfaceHandle& window, |
| 106 int32 render_view_id, | 117 int32 render_view_id, |
| 107 int32 client_id, | 118 int32 client_id, |
| 108 const GPUCreateCommandBufferConfig& init_params); | 119 const GPUCreateCommandBufferConfig& init_params); |
| 120 void CreateImage( |
| 121 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); |
| 122 void OnCreateImage( |
| 123 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); |
| 124 void DeleteImage(int32 client_id, int32 image_id); |
| 125 void OnDeleteImage(int32 client_id, int32 image_id, int32 sync_point); |
| 126 void OnDeleteImageSyncPointRetired(ImageOperation*); |
| 109 | 127 |
| 110 void OnLoseAllContexts(); | 128 void OnLoseAllContexts(); |
| 111 | 129 |
| 112 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 130 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 113 base::WaitableEvent* shutdown_event_; | 131 base::WaitableEvent* shutdown_event_; |
| 114 | 132 |
| 115 // Used to send and receive IPC messages from the browser process. | 133 // Used to send and receive IPC messages from the browser process. |
| 116 ChildThread* gpu_child_thread_; | 134 ChildThread* gpu_child_thread_; |
| 117 | 135 |
| 118 // These objects manage channels to individual renderer processes there is | 136 // These objects manage channels to individual renderer processes there is |
| 119 // 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 |
| 120 // process. | 138 // process. |
| 121 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | |
| 122 GpuChannelMap gpu_channels_; | 139 GpuChannelMap gpu_channels_; |
| 123 scoped_refptr<gfx::GLShareGroup> share_group_; | 140 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 124 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 141 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 125 GpuMemoryManager gpu_memory_manager_; | 142 GpuMemoryManager gpu_memory_manager_; |
| 126 GpuWatchdog* watchdog_; | 143 GpuWatchdog* watchdog_; |
| 127 scoped_refptr<SyncPointManager> sync_point_manager_; | 144 scoped_refptr<SyncPointManager> sync_point_manager_; |
| 128 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 145 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
| 129 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 146 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
| 147 ImageOperationQueue image_operations_; |
| 130 | 148 |
| 131 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 149 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 132 }; | 150 }; |
| 133 | 151 |
| 134 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 152 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |