| 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" | 16 #include "base/message_loop/message_loop_proxy.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/content_param_traits.h" | 19 #include "content/common/content_param_traits.h" |
| 20 #include "content/common/gpu/gpu_memory_manager.h" | 20 #include "content/common/gpu/gpu_memory_manager.h" |
| 21 #include "ipc/ipc_listener.h" | 21 #include "ipc/ipc_listener.h" |
| 22 #include "ipc/ipc_sender.h" | 22 #include "ipc/ipc_sender.h" |
| 23 #include "ui/gfx/gpu_memory_buffer.h" | 23 #include "ui/gfx/gpu_memory_buffer.h" |
| 24 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
| 25 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
| 26 | 26 |
| 27 struct GpuMsg_CreateGpuMemoryBuffer_Params; |
| 28 |
| 27 namespace base { | 29 namespace base { |
| 28 class WaitableEvent; | 30 class WaitableEvent; |
| 29 } | 31 } |
| 30 | 32 |
| 31 namespace gfx { | 33 namespace gfx { |
| 32 class GLShareGroup; | 34 class GLShareGroup; |
| 33 struct GpuMemoryBufferHandle; | 35 struct GpuMemoryBufferHandle; |
| 34 } | 36 } |
| 35 | 37 |
| 36 namespace gpu { | 38 namespace gpu { |
| 37 class SyncPointManager; | 39 class SyncPointManager; |
| 38 union ValueState; | 40 union ValueState; |
| 39 namespace gles2 { | 41 namespace gles2 { |
| 40 class MailboxManager; | 42 class MailboxManager; |
| 41 class ProgramCache; | 43 class ProgramCache; |
| 42 class ShaderTranslatorCache; | 44 class ShaderTranslatorCache; |
| 43 } | 45 } |
| 44 } | 46 } |
| 45 | 47 |
| 46 namespace IPC { | 48 namespace IPC { |
| 47 struct ChannelHandle; | 49 struct ChannelHandle; |
| 48 class SyncChannel; | 50 class SyncChannel; |
| 49 class MessageFilter; | |
| 50 } | 51 } |
| 51 | 52 |
| 52 struct GPUCreateCommandBufferConfig; | 53 struct GPUCreateCommandBufferConfig; |
| 53 | 54 |
| 54 namespace content { | 55 namespace content { |
| 55 class GpuChannel; | 56 class GpuChannel; |
| 56 class GpuMemoryBufferFactory; | 57 class GpuMemoryBufferFactory; |
| 57 class GpuWatchdog; | 58 class GpuWatchdog; |
| 58 class MessageRouter; | 59 class MessageRouter; |
| 59 | 60 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 116 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
| 116 void OnVisibilityChanged( | 117 void OnVisibilityChanged( |
| 117 int32 render_view_id, int32 client_id, bool visible); | 118 int32 render_view_id, int32 client_id, bool visible); |
| 118 void OnCreateViewCommandBuffer( | 119 void OnCreateViewCommandBuffer( |
| 119 const gfx::GLSurfaceHandle& window, | 120 const gfx::GLSurfaceHandle& window, |
| 120 int32 render_view_id, | 121 int32 render_view_id, |
| 121 int32 client_id, | 122 int32 client_id, |
| 122 const GPUCreateCommandBufferConfig& init_params, | 123 const GPUCreateCommandBufferConfig& init_params, |
| 123 int32 route_id); | 124 int32 route_id); |
| 124 void OnLoadedShader(std::string shader); | 125 void OnLoadedShader(std::string shader); |
| 126 void OnCreateGpuMemoryBuffer( |
| 127 const GpuMsg_CreateGpuMemoryBuffer_Params& params); |
| 125 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); | 128 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
| 126 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id); | |
| 127 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 129 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 128 int client_id, | 130 int client_id, |
| 129 int32 sync_point); | 131 int32 sync_point); |
| 130 | 132 |
| 131 void OnRelinquishResources(); | 133 void OnRelinquishResources(); |
| 132 void OnResourcesRelinquished(); | 134 void OnResourcesRelinquished(); |
| 133 | 135 |
| 134 void OnUpdateValueState(int client_id, | 136 void OnUpdateValueState(int client_id, |
| 135 unsigned int target, | 137 unsigned int target, |
| 136 const gpu::ValueState& state); | 138 const gpu::ValueState& state); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 151 scoped_refptr<gfx::GLShareGroup> share_group_; | 153 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 152 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 154 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 153 GpuMemoryManager gpu_memory_manager_; | 155 GpuMemoryManager gpu_memory_manager_; |
| 154 GpuWatchdog* watchdog_; | 156 GpuWatchdog* watchdog_; |
| 155 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; | 157 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; |
| 156 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 158 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
| 157 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 159 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
| 158 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 160 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
| 159 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 161 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
| 160 IPC::SyncChannel* channel_; | 162 IPC::SyncChannel* channel_; |
| 161 scoped_refptr<IPC::MessageFilter> filter_; | |
| 162 bool relinquish_resources_pending_; | 163 bool relinquish_resources_pending_; |
| 163 | 164 |
| 164 // Member variables should appear before the WeakPtrFactory, to ensure | 165 // Member variables should appear before the WeakPtrFactory, to ensure |
| 165 // that any WeakPtrs to Controller are invalidated before its members | 166 // that any WeakPtrs to Controller are invalidated before its members |
| 166 // variable's destructors are executed, rendering them invalid. | 167 // variable's destructors are executed, rendering them invalid. |
| 167 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 168 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 168 | 169 |
| 169 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 170 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 170 }; | 171 }; |
| 171 | 172 |
| 172 } // namespace content | 173 } // namespace content |
| 173 | 174 |
| 174 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 175 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |