| 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> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Remove the channel for a particular renderer. | 76 // Remove the channel for a particular renderer. |
| 77 void RemoveChannel(int client_id); | 77 void RemoveChannel(int client_id); |
| 78 | 78 |
| 79 // Listener overrides. | 79 // Listener overrides. |
| 80 bool OnMessageReceived(const IPC::Message& msg) override; | 80 bool OnMessageReceived(const IPC::Message& msg) override; |
| 81 | 81 |
| 82 // Sender overrides. | 82 // Sender overrides. |
| 83 bool Send(IPC::Message* msg) override; | 83 bool Send(IPC::Message* msg) override; |
| 84 | 84 |
| 85 uint32_t ProcessedOrderNumber(); | |
| 86 uint32_t UnprocessedOrderNumber(); | |
| 87 | |
| 88 void LoseAllContexts(); | 85 void LoseAllContexts(); |
| 89 | 86 |
| 90 int GenerateRouteID(); | 87 int GenerateRouteID(); |
| 91 void AddRoute(int32 routing_id, IPC::Listener* listener); | 88 void AddRoute(int32 routing_id, IPC::Listener* listener); |
| 92 void RemoveRoute(int32 routing_id); | 89 void RemoveRoute(int32 routing_id); |
| 93 | 90 |
| 94 gpu::gles2::ProgramCache* program_cache(); | 91 gpu::gles2::ProgramCache* program_cache(); |
| 95 gpu::gles2::ShaderTranslatorCache* shader_translator_cache(); | 92 gpu::gles2::ShaderTranslatorCache* shader_translator_cache(); |
| 96 gpu::gles2::FramebufferCompletenessCache* framebuffer_completeness_cache(); | 93 gpu::gles2::FramebufferCompletenessCache* framebuffer_completeness_cache(); |
| 97 | 94 |
| 98 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } | 95 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } |
| 99 | 96 |
| 100 GpuChannel* LookupChannel(int32 client_id); | 97 GpuChannel* LookupChannel(int32 client_id) const; |
| 101 | 98 |
| 102 gpu::SyncPointManager* sync_point_manager() { | 99 gpu::SyncPointManager* sync_point_manager() { |
| 103 return sync_point_manager_; | 100 return sync_point_manager_; |
| 104 } | 101 } |
| 105 | 102 |
| 106 gfx::GLSurface* GetDefaultOffscreenSurface(); | 103 gfx::GLSurface* GetDefaultOffscreenSurface(); |
| 107 | 104 |
| 108 GpuMemoryBufferFactory* gpu_memory_buffer_factory() { | 105 GpuMemoryBufferFactory* gpu_memory_buffer_factory() { |
| 109 return gpu_memory_buffer_factory_; | 106 return gpu_memory_buffer_factory_; |
| 110 } | 107 } |
| 111 | 108 |
| 109 // Increments the global order number used for IPC messages and returns the |
| 110 // new value. |
| 111 uint32_t GetNextUnprocessedOrderNum(); |
| 112 |
| 113 // Returns the current value of the global order number used for IPC messages. |
| 114 uint32_t GetCurrentUnprocessedOrderNum() const; |
| 115 |
| 116 // Returns the maximum order number for processed IPC messages across all |
| 117 // channels. |
| 118 uint32_t GetProcessedOrderNum() const; |
| 119 |
| 112 protected: | 120 protected: |
| 113 virtual scoped_ptr<GpuChannel> CreateGpuChannel( | 121 virtual scoped_ptr<GpuChannel> CreateGpuChannel( |
| 114 gfx::GLShareGroup* share_group, | 122 gfx::GLShareGroup* share_group, |
| 115 gpu::gles2::MailboxManager* mailbox_manager, | 123 gpu::gles2::MailboxManager* mailbox_manager, |
| 116 int client_id, | 124 int client_id, |
| 117 uint64_t client_tracing_id, | 125 uint64_t client_tracing_id, |
| 118 bool allow_future_sync_points, | 126 bool allow_future_sync_points, |
| 119 bool allow_real_time_streams); | 127 bool allow_real_time_streams); |
| 120 | 128 |
| 121 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 129 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 gpu::SyncPointManager* sync_point_manager_; | 178 gpu::SyncPointManager* sync_point_manager_; |
| 171 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 179 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
| 172 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 180 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
| 173 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 181 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
| 174 framebuffer_completeness_cache_; | 182 framebuffer_completeness_cache_; |
| 175 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 183 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
| 176 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 184 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
| 177 // Must outlive this instance of GpuChannelManager. | 185 // Must outlive this instance of GpuChannelManager. |
| 178 IPC::AttachmentBroker* attachment_broker_; | 186 IPC::AttachmentBroker* attachment_broker_; |
| 179 | 187 |
| 188 uint32_t unprocessed_order_num_; |
| 189 mutable base::Lock order_num_lock_; // Guards unprocessed_order_num_. |
| 190 |
| 180 // Member variables should appear before the WeakPtrFactory, to ensure | 191 // Member variables should appear before the WeakPtrFactory, to ensure |
| 181 // that any WeakPtrs to Controller are invalidated before its members | 192 // that any WeakPtrs to Controller are invalidated before its members |
| 182 // variable's destructors are executed, rendering them invalid. | 193 // variable's destructors are executed, rendering them invalid. |
| 183 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 194 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 184 | 195 |
| 185 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 196 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 186 }; | 197 }; |
| 187 | 198 |
| 188 } // namespace content | 199 } // namespace content |
| 189 | 200 |
| 190 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 201 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |