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

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

Issue 2275113002: Provide task runner to GLES2Impl / CommandBuffer at creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-cleanup4
Patch Set: cleanup Created 4 years, 4 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 executor_->PutChanged(); 247 executor_->PutChanged();
248 } 248 }
249 249
250 bool InProcessCommandBuffer::Initialize( 250 bool InProcessCommandBuffer::Initialize(
251 scoped_refptr<gl::GLSurface> surface, 251 scoped_refptr<gl::GLSurface> surface,
252 bool is_offscreen, 252 bool is_offscreen,
253 gfx::AcceleratedWidget window, 253 gfx::AcceleratedWidget window,
254 const gles2::ContextCreationAttribHelper& attribs, 254 const gles2::ContextCreationAttribHelper& attribs,
255 InProcessCommandBuffer* share_group, 255 InProcessCommandBuffer* share_group,
256 GpuMemoryBufferManager* gpu_memory_buffer_manager, 256 GpuMemoryBufferManager* gpu_memory_buffer_manager,
257 ImageFactory* image_factory) { 257 ImageFactory* image_factory,
258 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
258 DCHECK(!share_group || service_.get() == share_group->service_.get()); 259 DCHECK(!share_group || service_.get() == share_group->service_.get());
259 260
260 if (surface) { 261 if (surface) {
262 // If a surface is provided, we are running in a webview and should not have
263 // a task runner.
264 DCHECK(!task_runner);
265
261 // GPU thread must be the same as client thread due to GLSurface not being 266 // GPU thread must be the same as client thread due to GLSurface not being
262 // thread safe. 267 // thread safe.
263 sequence_checker_.reset(new base::SequenceChecker); 268 sequence_checker_.reset(new base::SequenceChecker);
264 surface_ = surface; 269 surface_ = surface;
265 } else { 270 } else {
266 origin_task_runner_ = base::ThreadTaskRunnerHandle::Get(); 271 origin_task_runner_ = std::move(task_runner);
267 client_thread_weak_ptr_ = client_thread_weak_ptr_factory_.GetWeakPtr(); 272 client_thread_weak_ptr_ = client_thread_weak_ptr_factory_.GetWeakPtr();
268 } 273 }
269 274
270 gpu::Capabilities capabilities; 275 gpu::Capabilities capabilities;
271 InitializeOnGpuThreadParams params(is_offscreen, window, attribs, 276 InitializeOnGpuThreadParams params(is_offscreen, window, attribs,
272 &capabilities, share_group, image_factory); 277 &capabilities, share_group, image_factory);
273 278
274 base::Callback<bool(void)> init_task = 279 base::Callback<bool(void)> init_task =
275 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, 280 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread,
276 base::Unretained(this), params); 281 base::Unretained(this), params);
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 framebuffer_completeness_cache_ = 1059 framebuffer_completeness_cache_ =
1055 new gpu::gles2::FramebufferCompletenessCache; 1060 new gpu::gles2::FramebufferCompletenessCache;
1056 return framebuffer_completeness_cache_; 1061 return framebuffer_completeness_cache_;
1057 } 1062 }
1058 1063
1059 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1064 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1060 return sync_point_manager_; 1065 return sync_point_manager_;
1061 } 1066 }
1062 1067
1063 } // namespace gpu 1068 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698