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 GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ |
6 #define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ | 6 #define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <unordered_map> | 13 #include <unordered_map> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "gpu/command_buffer/common/constants.h" | 20 #include "gpu/command_buffer/common/constants.h" |
21 #include "gpu/command_buffer/service/gpu_preferences.h" | 21 #include "gpu/command_buffer/service/gpu_preferences.h" |
22 #include "gpu/config/gpu_driver_bug_workarounds.h" | 22 #include "gpu/config/gpu_driver_bug_workarounds.h" |
| 23 #include "gpu/config/gpu_feature_info.h" |
23 #include "gpu/gpu_export.h" | 24 #include "gpu/gpu_export.h" |
24 #include "gpu/ipc/service/gpu_memory_manager.h" | 25 #include "gpu/ipc/service/gpu_memory_manager.h" |
25 #include "ui/gfx/gpu_memory_buffer.h" | 26 #include "ui/gfx/gpu_memory_buffer.h" |
26 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
27 #include "ui/gl/gl_surface.h" | 28 #include "ui/gl/gl_surface.h" |
28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
29 | 30 |
30 namespace base { | 31 namespace base { |
31 class WaitableEvent; | 32 class WaitableEvent; |
32 } | 33 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // browser process to them based on the corresponding renderer ID. | 65 // browser process to them based on the corresponding renderer ID. |
65 class GPU_EXPORT GpuChannelManager { | 66 class GPU_EXPORT GpuChannelManager { |
66 public: | 67 public: |
67 GpuChannelManager(const GpuPreferences& gpu_preferences, | 68 GpuChannelManager(const GpuPreferences& gpu_preferences, |
68 GpuChannelManagerDelegate* delegate, | 69 GpuChannelManagerDelegate* delegate, |
69 GpuWatchdogThread* watchdog, | 70 GpuWatchdogThread* watchdog, |
70 base::SingleThreadTaskRunner* task_runner, | 71 base::SingleThreadTaskRunner* task_runner, |
71 base::SingleThreadTaskRunner* io_task_runner, | 72 base::SingleThreadTaskRunner* io_task_runner, |
72 base::WaitableEvent* shutdown_event, | 73 base::WaitableEvent* shutdown_event, |
73 SyncPointManager* sync_point_manager, | 74 SyncPointManager* sync_point_manager, |
74 GpuMemoryBufferFactory* gpu_memory_buffer_factory); | 75 GpuMemoryBufferFactory* gpu_memory_buffer_factory, |
| 76 const GpuFeatureInfo& gpu_feature_info); |
75 virtual ~GpuChannelManager(); | 77 virtual ~GpuChannelManager(); |
76 | 78 |
77 GpuChannelManagerDelegate* delegate() const { return delegate_; } | 79 GpuChannelManagerDelegate* delegate() const { return delegate_; } |
78 | 80 |
79 IPC::ChannelHandle EstablishChannel(int client_id, | 81 IPC::ChannelHandle EstablishChannel(int client_id, |
80 uint64_t client_tracing_id, | 82 uint64_t client_tracing_id, |
81 bool preempts, | 83 bool preempts, |
82 bool allow_view_command_buffers, | 84 bool allow_view_command_buffers, |
83 bool allow_real_time_streams); | 85 bool allow_real_time_streams); |
84 | 86 |
(...skipping 11 matching lines...) Expand all Loading... |
96 | 98 |
97 void LoseAllContexts(); | 99 void LoseAllContexts(); |
98 void MaybeExitOnContextLost(); | 100 void MaybeExitOnContextLost(); |
99 | 101 |
100 const GpuPreferences& gpu_preferences() const { | 102 const GpuPreferences& gpu_preferences() const { |
101 return gpu_preferences_; | 103 return gpu_preferences_; |
102 } | 104 } |
103 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds() const { | 105 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds() const { |
104 return gpu_driver_bug_workarounds_; | 106 return gpu_driver_bug_workarounds_; |
105 } | 107 } |
| 108 const GpuFeatureInfo& gpu_feature_info() const { return gpu_feature_info_; } |
106 gles2::ProgramCache* program_cache(); | 109 gles2::ProgramCache* program_cache(); |
107 gles2::ShaderTranslatorCache* shader_translator_cache(); | 110 gles2::ShaderTranslatorCache* shader_translator_cache(); |
108 gles2::FramebufferCompletenessCache* framebuffer_completeness_cache(); | 111 gles2::FramebufferCompletenessCache* framebuffer_completeness_cache(); |
109 | 112 |
110 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } | 113 GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; } |
111 | 114 |
112 GpuChannel* LookupChannel(int32_t client_id) const; | 115 GpuChannel* LookupChannel(int32_t client_id) const; |
113 | 116 |
114 gl::GLSurface* GetDefaultOffscreenSurface(); | 117 gl::GLSurface* GetDefaultOffscreenSurface(); |
115 | 118 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 GpuMemoryManager gpu_memory_manager_; | 188 GpuMemoryManager gpu_memory_manager_; |
186 // SyncPointManager guaranteed to outlive running MessageLoop. | 189 // SyncPointManager guaranteed to outlive running MessageLoop. |
187 SyncPointManager* sync_point_manager_; | 190 SyncPointManager* sync_point_manager_; |
188 std::unique_ptr<SyncPointClient> sync_point_client_waiter_; | 191 std::unique_ptr<SyncPointClient> sync_point_client_waiter_; |
189 std::unique_ptr<gles2::ProgramCache> program_cache_; | 192 std::unique_ptr<gles2::ProgramCache> program_cache_; |
190 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache_; | 193 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache_; |
191 scoped_refptr<gles2::FramebufferCompletenessCache> | 194 scoped_refptr<gles2::FramebufferCompletenessCache> |
192 framebuffer_completeness_cache_; | 195 framebuffer_completeness_cache_; |
193 scoped_refptr<gl::GLSurface> default_offscreen_surface_; | 196 scoped_refptr<gl::GLSurface> default_offscreen_surface_; |
194 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 197 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
| 198 GpuFeatureInfo gpu_feature_info_; |
195 #if defined(OS_ANDROID) | 199 #if defined(OS_ANDROID) |
196 // Last time we know the GPU was powered on. Global for tracking across all | 200 // Last time we know the GPU was powered on. Global for tracking across all |
197 // transport surfaces. | 201 // transport surfaces. |
198 base::TimeTicks last_gpu_access_time_; | 202 base::TimeTicks last_gpu_access_time_; |
199 base::TimeTicks begin_wake_up_time_; | 203 base::TimeTicks begin_wake_up_time_; |
200 #endif | 204 #endif |
201 | 205 |
202 // Set during intentional GPU process shutdown. | 206 // Set during intentional GPU process shutdown. |
203 bool exiting_for_lost_context_; | 207 bool exiting_for_lost_context_; |
204 | 208 |
205 // Member variables should appear before the WeakPtrFactory, to ensure | 209 // Member variables should appear before the WeakPtrFactory, to ensure |
206 // that any WeakPtrs to Controller are invalidated before its members | 210 // that any WeakPtrs to Controller are invalidated before its members |
207 // variable's destructors are executed, rendering them invalid. | 211 // variable's destructors are executed, rendering them invalid. |
208 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 212 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
209 | 213 |
210 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 214 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
211 }; | 215 }; |
212 | 216 |
213 } // namespace gpu | 217 } // namespace gpu |
214 | 218 |
215 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ | 219 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |