| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace IPC { | 27 namespace IPC { |
| 28 struct ChannelHandle; | 28 struct ChannelHandle; |
| 29 } | 29 } |
| 30 | 30 |
| 31 class ChildThread; | 31 class ChildThread; |
| 32 class GpuChannel; | 32 class GpuChannel; |
| 33 class GpuWatchdog; | 33 class GpuWatchdog; |
| 34 struct GPUCreateCommandBufferConfig; | 34 struct GPUCreateCommandBufferConfig; |
| 35 class SyncPointManager; |
| 35 | 36 |
| 36 // A GpuChannelManager is a thread responsible for issuing rendering commands | 37 // A GpuChannelManager is a thread responsible for issuing rendering commands |
| 37 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 38 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
| 38 // browser process to them based on the corresponding renderer ID. | 39 // browser process to them based on the corresponding renderer ID. |
| 39 // | 40 // |
| 40 // A GpuChannelManager can also be hosted in the browser process in single | 41 // A GpuChannelManager can also be hosted in the browser process in single |
| 41 // process or in-process GPU modes. In this case there is no corresponding | 42 // process or in-process GPU modes. In this case there is no corresponding |
| 42 // GpuChildThread and this is the reason the GpuChildThread is referenced via | 43 // GpuChildThread and this is the reason the GpuChildThread is referenced via |
| 43 // a pointer to IPC::Message::Sender, which can be implemented by other hosts | 44 // a pointer to IPC::Message::Sender, which can be implemented by other hosts |
| 44 // to send IPC messages to the browser process IO thread on the | 45 // to send IPC messages to the browser process IO thread on the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 71 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 72 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 72 | 73 |
| 73 int GenerateRouteID(); | 74 int GenerateRouteID(); |
| 74 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 75 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
| 75 void RemoveRoute(int32 routing_id); | 76 void RemoveRoute(int32 routing_id); |
| 76 | 77 |
| 77 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } | 78 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } |
| 78 | 79 |
| 79 GpuChannel* LookupChannel(int32 client_id); | 80 GpuChannel* LookupChannel(int32 client_id); |
| 80 | 81 |
| 82 SyncPointManager* sync_point_manager() { return sync_point_manager_; } |
| 83 |
| 81 private: | 84 private: |
| 82 // Message handlers. | 85 // Message handlers. |
| 83 void OnEstablishChannel(int client_id, bool share_context); | 86 void OnEstablishChannel(int client_id, bool share_context); |
| 84 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 87 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
| 85 void OnVisibilityChanged( | 88 void OnVisibilityChanged( |
| 86 int32 render_view_id, int32 client_id, bool visible); | 89 int32 render_view_id, int32 client_id, bool visible); |
| 87 void OnCreateViewCommandBuffer( | 90 void OnCreateViewCommandBuffer( |
| 88 const gfx::GLSurfaceHandle& window, | 91 const gfx::GLSurfaceHandle& window, |
| 89 int32 render_view_id, | 92 int32 render_view_id, |
| 90 int32 client_id, | 93 int32 client_id, |
| 91 const GPUCreateCommandBufferConfig& init_params); | 94 const GPUCreateCommandBufferConfig& init_params); |
| 92 | 95 |
| 93 void OnLoseAllContexts(); | 96 void OnLoseAllContexts(); |
| 94 | 97 |
| 95 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 98 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 96 base::WaitableEvent* shutdown_event_; | 99 base::WaitableEvent* shutdown_event_; |
| 97 | 100 |
| 98 // Used to send and receive IPC messages from the browser process. | 101 // Used to send and receive IPC messages from the browser process. |
| 99 ChildThread* gpu_child_thread_; | 102 ChildThread* gpu_child_thread_; |
| 100 | 103 |
| 101 // These objects manage channels to individual renderer processes there is | 104 // These objects manage channels to individual renderer processes there is |
| 102 // one channel for each renderer process that has connected to this GPU | 105 // one channel for each renderer process that has connected to this GPU |
| 103 // process. | 106 // process. |
| 104 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | 107 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
| 105 GpuChannelMap gpu_channels_; | 108 GpuChannelMap gpu_channels_; |
| 106 scoped_refptr<gfx::GLShareGroup> share_group_; | 109 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 107 GpuMemoryManager gpu_memory_manager_; | 110 GpuMemoryManager gpu_memory_manager_; |
| 108 GpuWatchdog* watchdog_; | 111 GpuWatchdog* watchdog_; |
| 112 scoped_refptr<SyncPointManager> sync_point_manager_; |
| 109 | 113 |
| 110 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 114 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 117 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |