Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.h

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/atomic_sequence_num.h" 14 #include "base/atomic_sequence_num.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/containers/scoped_ptr_hash_map.h" 17 #include "base/containers/scoped_ptr_hash_map.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
23 #include "base/synchronization/waitable_event.h" 23 #include "base/synchronization/waitable_event.h"
24 #include "base/threading/thread.h" 24 #include "base/threading/thread.h"
25 #include "gpu/command_buffer/client/gpu_control.h" 25 #include "gpu/command_buffer/client/gpu_control.h"
26 #include "gpu/command_buffer/common/command_buffer.h" 26 #include "gpu/command_buffer/common/command_buffer.h"
27 #include "gpu/command_buffer/service/gpu_preferences.h"
27 #include "gpu/gpu_export.h" 28 #include "gpu/gpu_export.h"
28 #include "ui/gfx/gpu_memory_buffer.h" 29 #include "ui/gfx/gpu_memory_buffer.h"
29 #include "ui/gfx/native_widget_types.h" 30 #include "ui/gfx/native_widget_types.h"
30 #include "ui/gl/gl_surface.h" 31 #include "ui/gl/gl_surface.h"
31 #include "ui/gl/gpu_preference.h" 32 #include "ui/gl/gpu_preference.h"
32 33
33 namespace base { 34 namespace base {
34 class SequenceChecker; 35 class SequenceChecker;
35 } 36 }
36 37
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool IsFenceSyncFlushed(uint64_t release) override; 135 bool IsFenceSyncFlushed(uint64_t release) override;
135 bool IsFenceSyncFlushReceived(uint64_t release) override; 136 bool IsFenceSyncFlushReceived(uint64_t release) override;
136 void SignalSyncToken(const SyncToken& sync_token, 137 void SignalSyncToken(const SyncToken& sync_token,
137 const base::Closure& callback) override; 138 const base::Closure& callback) override;
138 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; 139 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override;
139 140
140 // The serializer interface to the GPU service (i.e. thread). 141 // The serializer interface to the GPU service (i.e. thread).
141 class Service { 142 class Service {
142 public: 143 public:
143 Service(); 144 Service();
145 explicit Service(const gpu::GpuPreferences& gpu_preferences);
144 virtual ~Service(); 146 virtual ~Service();
145 147
146 virtual void AddRef() const = 0; 148 virtual void AddRef() const = 0;
147 virtual void Release() const = 0; 149 virtual void Release() const = 0;
148 150
149 // Queues a task to run as soon as possible. 151 // Queues a task to run as soon as possible.
150 virtual void ScheduleTask(const base::Closure& task) = 0; 152 virtual void ScheduleTask(const base::Closure& task) = 0;
151 153
152 // Schedules |callback| to run at an appropriate time for performing delayed 154 // Schedules |callback| to run at an appropriate time for performing delayed
153 // work. 155 // work.
154 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; 156 virtual void ScheduleDelayedWork(const base::Closure& task) = 0;
155 157
156 virtual bool UseVirtualizedGLContexts() = 0; 158 virtual bool UseVirtualizedGLContexts() = 0;
157 virtual scoped_refptr<gles2::ShaderTranslatorCache> 159 virtual scoped_refptr<gles2::ShaderTranslatorCache>
158 shader_translator_cache() = 0; 160 shader_translator_cache() = 0;
159 virtual scoped_refptr<gles2::FramebufferCompletenessCache> 161 virtual scoped_refptr<gles2::FramebufferCompletenessCache>
160 framebuffer_completeness_cache() = 0; 162 framebuffer_completeness_cache() = 0;
161 virtual SyncPointManager* sync_point_manager() = 0; 163 virtual SyncPointManager* sync_point_manager() = 0;
164 const GpuPreferences& gpu_preferences();
162 scoped_refptr<gfx::GLShareGroup> share_group(); 165 scoped_refptr<gfx::GLShareGroup> share_group();
163 scoped_refptr<gles2::MailboxManager> mailbox_manager(); 166 scoped_refptr<gles2::MailboxManager> mailbox_manager();
164 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); 167 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set();
165 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); 168 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state();
166 gpu::gles2::ProgramCache* program_cache(); 169 gpu::gles2::ProgramCache* program_cache();
167 170
168 private: 171 private:
172 const GpuPreferences gpu_preferences_;
169 scoped_refptr<gfx::GLShareGroup> share_group_; 173 scoped_refptr<gfx::GLShareGroup> share_group_;
170 scoped_refptr<gles2::MailboxManager> mailbox_manager_; 174 scoped_refptr<gles2::MailboxManager> mailbox_manager_;
171 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; 175 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_;
172 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; 176 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_;
173 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; 177 scoped_ptr<gpu::gles2::ProgramCache> program_cache_;
174 }; 178 };
175 179
176 #if defined(OS_ANDROID) 180 #if defined(OS_ANDROID)
177 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id); 181 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id);
178 uint32_t CreateStreamTexture(uint32_t texture_id); 182 uint32_t CreateStreamTexture(uint32_t texture_id);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 SyncPointManager* sync_point_manager_; // Non-owning. 320 SyncPointManager* sync_point_manager_; // Non-owning.
317 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 321 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
318 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> 322 scoped_refptr<gpu::gles2::FramebufferCompletenessCache>
319 framebuffer_completeness_cache_; 323 framebuffer_completeness_cache_;
320 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); 324 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread);
321 }; 325 };
322 326
323 } // namespace gpu 327 } // namespace gpu
324 328
325 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 329 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_preferences.cc ('k') | gpu/command_buffer/service/in_process_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698