| 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" |
| 19 #include "content/common/content_param_traits.h" |
| 18 #include "content/common/gpu/devtools_gpu_instrumentation.h" | 20 #include "content/common/gpu/devtools_gpu_instrumentation.h" |
| 19 #include "content/common/gpu/gpu_memory_manager.h" | 21 #include "content/common/gpu/gpu_memory_manager.h" |
| 20 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
| 21 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
| 22 #include "ui/gfx/gpu_memory_buffer.h" | 24 #include "ui/gfx/gpu_memory_buffer.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
| 24 #include "ui/gl/gl_surface.h" | 26 #include "ui/gl/gl_surface.h" |
| 25 | 27 |
| 26 namespace base { | 28 namespace base { |
| 27 class WaitableEvent; | 29 class WaitableEvent; |
| 28 } | 30 } |
| 29 | 31 |
| 30 namespace gfx { | 32 namespace gfx { |
| 31 class GLShareGroup; | 33 class GLShareGroup; |
| 32 struct GpuMemoryBufferHandle; | 34 struct GpuMemoryBufferHandle; |
| 33 } | 35 } |
| 34 | 36 |
| 35 namespace gpu { | 37 namespace gpu { |
| 36 class SyncPointManager; | 38 class SyncPointManager; |
| 39 union ValueState; |
| 37 namespace gles2 { | 40 namespace gles2 { |
| 38 class MailboxManager; | 41 class MailboxManager; |
| 39 class ProgramCache; | 42 class ProgramCache; |
| 40 class ShaderTranslatorCache; | 43 class ShaderTranslatorCache; |
| 41 } | 44 } |
| 42 } | 45 } |
| 43 | 46 |
| 44 namespace IPC { | 47 namespace IPC { |
| 45 struct ChannelHandle; | 48 struct ChannelHandle; |
| 46 class SyncChannel; | 49 class SyncChannel; |
| 47 class MessageFilter; | 50 class MessageFilter; |
| 48 } | 51 } |
| 49 | 52 |
| 50 struct GPUCreateCommandBufferConfig; | 53 struct GPUCreateCommandBufferConfig; |
| 51 | 54 |
| 52 namespace content { | 55 namespace content { |
| 53 class GpuChannel; | 56 class GpuChannel; |
| 54 class GpuMemoryBufferFactory; | 57 class GpuMemoryBufferFactory; |
| 55 class GpuWatchdog; | 58 class GpuWatchdog; |
| 56 class MessageRouter; | 59 class MessageRouter; |
| 57 | 60 |
| 58 // A GpuChannelManager is a thread responsible for issuing rendering commands | 61 // A GpuChannelManager is a thread responsible for issuing rendering commands |
| 59 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 62 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
| 60 // browser process to them based on the corresponding renderer ID. | 63 // browser process to them based on the corresponding renderer ID. |
| 61 class GpuChannelManager : public IPC::Listener, | 64 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
| 62 public IPC::Sender { | 65 public IPC::Sender { |
| 63 public: | 66 public: |
| 64 GpuChannelManager(MessageRouter* router, | 67 GpuChannelManager(MessageRouter* router, |
| 65 GpuWatchdog* watchdog, | 68 GpuWatchdog* watchdog, |
| 66 base::MessageLoopProxy* io_message_loop, | 69 base::MessageLoopProxy* io_message_loop, |
| 67 base::WaitableEvent* shutdown_event, | 70 base::WaitableEvent* shutdown_event, |
| 68 IPC::SyncChannel* channel); | 71 IPC::SyncChannel* channel); |
| 69 ~GpuChannelManager() override; | 72 ~GpuChannelManager() override; |
| 70 | 73 |
| 71 // Remove the channel for a particular renderer. | 74 // Remove the channel for a particular renderer. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 int32 render_view_id, | 125 int32 render_view_id, |
| 123 int32 client_id, | 126 int32 client_id, |
| 124 const GPUCreateCommandBufferConfig& init_params, | 127 const GPUCreateCommandBufferConfig& init_params, |
| 125 int32 route_id); | 128 int32 route_id); |
| 126 void OnLoadedShader(std::string shader); | 129 void OnLoadedShader(std::string shader); |
| 127 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); | 130 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
| 128 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id); | 131 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id); |
| 129 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 132 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 130 int client_id, | 133 int client_id, |
| 131 int32 sync_point); | 134 int32 sync_point); |
| 135 |
| 132 void OnRelinquishResources(); | 136 void OnRelinquishResources(); |
| 133 void OnResourcesRelinquished(); | 137 void OnResourcesRelinquished(); |
| 134 | 138 |
| 139 void OnUpdateValueState(int client_id, |
| 140 unsigned int target, |
| 141 const gpu::ValueState& state); |
| 142 |
| 135 void OnLoseAllContexts(); | 143 void OnLoseAllContexts(); |
| 136 | 144 |
| 137 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 145 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 138 base::WaitableEvent* shutdown_event_; | 146 base::WaitableEvent* shutdown_event_; |
| 139 | 147 |
| 140 // Used to send and receive IPC messages from the browser process. | 148 // Used to send and receive IPC messages from the browser process. |
| 141 MessageRouter* const router_; | 149 MessageRouter* const router_; |
| 142 | 150 |
| 143 // These objects manage channels to individual renderer processes there is | 151 // These objects manage channels to individual renderer processes there is |
| 144 // one channel for each renderer process that has connected to this GPU | 152 // one channel for each renderer process that has connected to this GPU |
| (...skipping 16 matching lines...) Expand all Loading... |
| 161 // that any WeakPtrs to Controller are invalidated before its members | 169 // that any WeakPtrs to Controller are invalidated before its members |
| 162 // variable's destructors are executed, rendering them invalid. | 170 // variable's destructors are executed, rendering them invalid. |
| 163 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 171 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 164 | 172 |
| 165 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 173 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 166 }; | 174 }; |
| 167 | 175 |
| 168 } // namespace content | 176 } // namespace content |
| 169 | 177 |
| 170 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 178 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |