Chromium Code Reviews| 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/threading/thread_checker.h" | |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 18 #include "content/common/content_param_traits.h" | 19 #include "content/common/content_param_traits.h" |
| 19 #include "content/common/gpu/gpu_memory_manager.h" | 20 #include "content/common/gpu/gpu_memory_manager.h" |
| 20 #include "content/common/message_router.h" | 21 #include "content/common/message_router.h" |
| 21 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
| 22 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
| 23 #include "ui/gfx/gpu_memory_buffer.h" | 24 #include "ui/gfx/gpu_memory_buffer.h" |
| 24 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
| 25 #include "ui/gl/gl_surface.h" | 26 #include "ui/gl/gl_surface.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 // Remove the channel for a particular renderer. | 77 // Remove the channel for a particular renderer. |
| 77 void RemoveChannel(int client_id); | 78 void RemoveChannel(int client_id); |
| 78 | 79 |
| 79 // Listener overrides. | 80 // Listener overrides. |
| 80 bool OnMessageReceived(const IPC::Message& msg) override; | 81 bool OnMessageReceived(const IPC::Message& msg) override; |
| 81 | 82 |
| 82 // Sender overrides. | 83 // Sender overrides. |
| 83 bool Send(IPC::Message* msg) override; | 84 bool Send(IPC::Message* msg) override; |
| 84 | 85 |
| 85 bool HandleMessagesScheduled(); | 86 bool HandleMessagesScheduled(); |
| 86 uint64 MessagesProcessed(); | 87 uint32_t ProcessedOrderNumber(); |
| 87 | 88 |
| 88 void LoseAllContexts(); | 89 void LoseAllContexts(); |
| 89 | 90 |
| 90 int GenerateRouteID(); | 91 int GenerateRouteID(); |
| 91 void AddRoute(int32 routing_id, IPC::Listener* listener); | 92 void AddRoute(int32 routing_id, IPC::Listener* listener); |
| 92 void RemoveRoute(int32 routing_id); | 93 void RemoveRoute(int32 routing_id); |
| 93 | 94 |
| 95 uint32_t GenerateGlobalOrderNumber(); | |
| 96 | |
| 94 gpu::gles2::ProgramCache* program_cache(); | 97 gpu::gles2::ProgramCache* program_cache(); |
| 95 gpu::gles2::ShaderTranslatorCache* shader_translator_cache(); | 98 gpu::gles2::ShaderTranslatorCache* shader_translator_cache(); |
| 96 gpu::gles2::FramebufferCompletenessCache* framebuffer_completeness_cache(); | 99 gpu::gles2::FramebufferCompletenessCache* framebuffer_completeness_cache(); |
| 97 | 100 |
| 98 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } | 101 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } |
| 99 | 102 |
| 100 GpuChannel* LookupChannel(int32 client_id); | 103 GpuChannel* LookupChannel(int32 client_id); |
| 101 | 104 |
| 102 gpu::SyncPointManager* sync_point_manager() { | 105 gpu::SyncPointManager* sync_point_manager() { |
| 103 return sync_point_manager_; | 106 return sync_point_manager_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id); | 149 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id); |
| 147 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 150 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 148 int client_id, | 151 int client_id, |
| 149 int32 sync_point); | 152 int32 sync_point); |
| 150 | 153 |
| 151 void OnUpdateValueState(int client_id, | 154 void OnUpdateValueState(int client_id, |
| 152 unsigned int target, | 155 unsigned int target, |
| 153 const gpu::ValueState& state); | 156 const gpu::ValueState& state); |
| 154 void OnLoseAllContexts(); | 157 void OnLoseAllContexts(); |
| 155 | 158 |
| 159 // Thread Checkers. | |
| 160 base::ThreadChecker io_thread_checker_; | |
| 161 | |
| 156 // Used to send and receive IPC messages from the browser process. | 162 // Used to send and receive IPC messages from the browser process. |
| 157 IPC::SyncChannel* const channel_; | 163 IPC::SyncChannel* const channel_; |
| 158 MessageRouter router_; | 164 MessageRouter router_; |
| 165 uint32_t global_order_counter_; | |
|
piman
2015/08/31 23:15:04
Use a AtomicSequenceNumber, then you don't need ex
David Yen
2015/09/01 02:01:52
This number is only operated on from the IO thread
| |
| 159 | 166 |
| 160 GpuWatchdog* watchdog_; | 167 GpuWatchdog* watchdog_; |
| 161 | 168 |
| 162 base::WaitableEvent* shutdown_event_; | 169 base::WaitableEvent* shutdown_event_; |
| 163 | 170 |
| 164 scoped_refptr<gfx::GLShareGroup> share_group_; | 171 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 165 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 172 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 166 GpuMemoryManager gpu_memory_manager_; | 173 GpuMemoryManager gpu_memory_manager_; |
| 167 // SyncPointManager guaranteed to outlive running MessageLoop. | 174 // SyncPointManager guaranteed to outlive running MessageLoop. |
| 168 gpu::SyncPointManager* sync_point_manager_; | 175 gpu::SyncPointManager* sync_point_manager_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 179 // that any WeakPtrs to Controller are invalidated before its members | 186 // that any WeakPtrs to Controller are invalidated before its members |
| 180 // variable's destructors are executed, rendering them invalid. | 187 // variable's destructors are executed, rendering them invalid. |
| 181 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 188 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 182 | 189 |
| 183 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 190 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 184 }; | 191 }; |
| 185 | 192 |
| 186 } // namespace content | 193 } // namespace content |
| 187 | 194 |
| 188 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 195 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |