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

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

Issue 2286873003: Provide TaskRunner to ContextCacheController (Closed)
Patch Set: fix unittests Created 4 years, 3 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 #include "gpu/command_buffer/service/in_process_command_buffer.h" 5 #include "gpu/command_buffer/service/in_process_command_buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 executor_->PutChanged(); 249 executor_->PutChanged();
250 } 250 }
251 251
252 bool InProcessCommandBuffer::Initialize( 252 bool InProcessCommandBuffer::Initialize(
253 scoped_refptr<gl::GLSurface> surface, 253 scoped_refptr<gl::GLSurface> surface,
254 bool is_offscreen, 254 bool is_offscreen,
255 gfx::AcceleratedWidget window, 255 gfx::AcceleratedWidget window,
256 const gles2::ContextCreationAttribHelper& attribs, 256 const gles2::ContextCreationAttribHelper& attribs,
257 InProcessCommandBuffer* share_group, 257 InProcessCommandBuffer* share_group,
258 GpuMemoryBufferManager* gpu_memory_buffer_manager, 258 GpuMemoryBufferManager* gpu_memory_buffer_manager,
259 ImageFactory* image_factory) { 259 ImageFactory* image_factory,
260 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
260 DCHECK(!share_group || service_.get() == share_group->service_.get()); 261 DCHECK(!share_group || service_.get() == share_group->service_.get());
261 262
262 if (surface) { 263 if (surface) {
264 // If a surface is provided, we are running in a webview and should not have
265 // a task runner.
266 DCHECK(!task_runner);
267
263 // GPU thread must be the same as client thread due to GLSurface not being 268 // GPU thread must be the same as client thread due to GLSurface not being
264 // thread safe. 269 // thread safe.
265 sequence_checker_.reset(new base::SequenceChecker); 270 sequence_checker_.reset(new base::SequenceChecker);
266 surface_ = surface; 271 surface_ = surface;
267 } else { 272 } else {
268 origin_task_runner_ = base::ThreadTaskRunnerHandle::Get(); 273 origin_task_runner_ = std::move(task_runner);
269 client_thread_weak_ptr_ = client_thread_weak_ptr_factory_.GetWeakPtr(); 274 client_thread_weak_ptr_ = client_thread_weak_ptr_factory_.GetWeakPtr();
270 } 275 }
271 276
272 gpu::Capabilities capabilities; 277 gpu::Capabilities capabilities;
273 InitializeOnGpuThreadParams params(is_offscreen, window, attribs, 278 InitializeOnGpuThreadParams params(is_offscreen, window, attribs,
274 &capabilities, share_group, image_factory); 279 &capabilities, share_group, image_factory);
275 280
276 base::Callback<bool(void)> init_task = 281 base::Callback<bool(void)> init_task =
277 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, 282 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread,
278 base::Unretained(this), params); 283 base::Unretained(this), params);
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 framebuffer_completeness_cache_ = 1061 framebuffer_completeness_cache_ =
1057 new gpu::gles2::FramebufferCompletenessCache; 1062 new gpu::gles2::FramebufferCompletenessCache;
1058 return framebuffer_completeness_cache_; 1063 return framebuffer_completeness_cache_;
1059 } 1064 }
1060 1065
1061 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1066 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1062 return sync_point_manager_; 1067 return sync_point_manager_;
1063 } 1068 }
1064 1069
1065 } // namespace gpu 1070 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698