| 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/trace_event/memory_dump_provider.h" | |
| 17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 18 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 19 #include "content/common/content_param_traits.h" | 18 #include "content/common/content_param_traits.h" |
| 20 #include "content/common/gpu/gpu_memory_manager.h" | 19 #include "content/common/gpu/gpu_memory_manager.h" |
| 21 #include "ipc/ipc_listener.h" | 20 #include "ipc/ipc_listener.h" |
| 22 #include "ipc/ipc_sender.h" | 21 #include "ipc/ipc_sender.h" |
| 23 #include "ui/gfx/gpu_memory_buffer.h" | 22 #include "ui/gfx/gpu_memory_buffer.h" |
| 24 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 25 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
| 26 | 25 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 54 namespace content { | 53 namespace content { |
| 55 class GpuChannel; | 54 class GpuChannel; |
| 56 class GpuMemoryBufferFactory; | 55 class GpuMemoryBufferFactory; |
| 57 class GpuWatchdog; | 56 class GpuWatchdog; |
| 58 class MessageRouter; | 57 class MessageRouter; |
| 59 | 58 |
| 60 // A GpuChannelManager is a thread responsible for issuing rendering commands | 59 // A GpuChannelManager is a thread responsible for issuing rendering commands |
| 61 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 60 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
| 62 // browser process to them based on the corresponding renderer ID. | 61 // browser process to them based on the corresponding renderer ID. |
| 63 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, | 62 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
| 64 public IPC::Sender, | 63 public IPC::Sender { |
| 65 public base::trace_event::MemoryDumpProvider { | |
| 66 public: | 64 public: |
| 67 GpuChannelManager(MessageRouter* router, | 65 GpuChannelManager(MessageRouter* router, |
| 68 GpuWatchdog* watchdog, | 66 GpuWatchdog* watchdog, |
| 69 base::SingleThreadTaskRunner* io_task_runner, | 67 base::SingleThreadTaskRunner* io_task_runner, |
| 70 base::WaitableEvent* shutdown_event, | 68 base::WaitableEvent* shutdown_event, |
| 71 IPC::SyncChannel* channel); | 69 IPC::SyncChannel* channel); |
| 72 ~GpuChannelManager() override; | 70 ~GpuChannelManager() override; |
| 73 | 71 |
| 74 // Remove the channel for a particular renderer. | 72 // Remove the channel for a particular renderer. |
| 75 void RemoveChannel(int client_id); | 73 void RemoveChannel(int client_id); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 gpu::SyncPointManager* sync_point_manager() { | 97 gpu::SyncPointManager* sync_point_manager() { |
| 100 return sync_point_manager_.get(); | 98 return sync_point_manager_.get(); |
| 101 } | 99 } |
| 102 | 100 |
| 103 gfx::GLSurface* GetDefaultOffscreenSurface(); | 101 gfx::GLSurface* GetDefaultOffscreenSurface(); |
| 104 | 102 |
| 105 GpuMemoryBufferFactory* gpu_memory_buffer_factory() { | 103 GpuMemoryBufferFactory* gpu_memory_buffer_factory() { |
| 106 return gpu_memory_buffer_factory_.get(); | 104 return gpu_memory_buffer_factory_.get(); |
| 107 } | 105 } |
| 108 | 106 |
| 109 // base::trace_event::MemoryDumpProvider implementation. | |
| 110 bool OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) override; | |
| 111 | |
| 112 private: | 107 private: |
| 113 typedef base::ScopedPtrHashMap<int, scoped_ptr<GpuChannel>> GpuChannelMap; | 108 typedef base::ScopedPtrHashMap<int, scoped_ptr<GpuChannel>> GpuChannelMap; |
| 114 | 109 |
| 115 // Message handlers. | 110 // Message handlers. |
| 116 void OnEstablishChannel(int client_id, | 111 void OnEstablishChannel(int client_id, |
| 117 bool share_context, | 112 bool share_context, |
| 118 bool allow_future_sync_points); | 113 bool allow_future_sync_points); |
| 119 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 114 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
| 120 void OnVisibilityChanged( | 115 void OnVisibilityChanged( |
| 121 int32 render_view_id, int32 client_id, bool visible); | 116 int32 render_view_id, int32 client_id, bool visible); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // that any WeakPtrs to Controller are invalidated before its members | 164 // that any WeakPtrs to Controller are invalidated before its members |
| 170 // variable's destructors are executed, rendering them invalid. | 165 // variable's destructors are executed, rendering them invalid. |
| 171 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 166 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 172 | 167 |
| 173 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 168 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 174 }; | 169 }; |
| 175 | 170 |
| 176 } // namespace content | 171 } // namespace content |
| 177 | 172 |
| 178 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 173 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |