| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferType type, | 130 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferType type, |
| 128 gfx::GpuMemoryBufferId id, | 131 gfx::GpuMemoryBufferId id, |
| 129 int client_id); | 132 int client_id); |
| 130 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferType type, | 133 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferType type, |
| 131 gfx::GpuMemoryBufferId id, | 134 gfx::GpuMemoryBufferId id, |
| 132 int client_id); | 135 int client_id); |
| 133 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferType type, | 136 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferType type, |
| 134 gfx::GpuMemoryBufferId id, | 137 gfx::GpuMemoryBufferId id, |
| 135 int client_id, | 138 int client_id, |
| 136 int32 sync_point); | 139 int32 sync_point); |
| 140 |
| 137 void OnRelinquishResources(); | 141 void OnRelinquishResources(); |
| 138 void OnResourcesRelinquished(); | 142 void OnResourcesRelinquished(); |
| 139 | 143 |
| 144 void OnUpdateValueState(int client_id, |
| 145 unsigned int target, |
| 146 const gpu::ValueState& state); |
| 147 |
| 140 void OnLoseAllContexts(); | 148 void OnLoseAllContexts(); |
| 141 | 149 |
| 142 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 150 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 143 base::WaitableEvent* shutdown_event_; | 151 base::WaitableEvent* shutdown_event_; |
| 144 | 152 |
| 145 // Used to send and receive IPC messages from the browser process. | 153 // Used to send and receive IPC messages from the browser process. |
| 146 MessageRouter* const router_; | 154 MessageRouter* const router_; |
| 147 | 155 |
| 148 // These objects manage channels to individual renderer processes there is | 156 // These objects manage channels to individual renderer processes there is |
| 149 // one channel for each renderer process that has connected to this GPU | 157 // one channel for each renderer process that has connected to this GPU |
| (...skipping 16 matching lines...) Expand all Loading... |
| 166 // that any WeakPtrs to Controller are invalidated before its members | 174 // that any WeakPtrs to Controller are invalidated before its members |
| 167 // variable's destructors are executed, rendering them invalid. | 175 // variable's destructors are executed, rendering them invalid. |
| 168 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 176 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 169 | 177 |
| 170 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 178 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 171 }; | 179 }; |
| 172 | 180 |
| 173 } // namespace content | 181 } // namespace content |
| 174 | 182 |
| 175 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 183 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |