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

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 2353033003: Idle cleanup for worker context (Closed)
Patch Set: fix windows build 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/common/gpu/client/context_provider_command_buffer.h" 5 #include "content/common/gpu/client/context_provider_command_buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 239
240 // Do this last once the context is set up. 240 // Do this last once the context is set up.
241 std::string type_name = 241 std::string type_name =
242 command_buffer_metrics::ContextTypeToString(context_type_); 242 command_buffer_metrics::ContextTypeToString(context_type_);
243 std::string unique_context_name = 243 std::string unique_context_name =
244 base::StringPrintf("%s-%p", type_name.c_str(), gles2_impl_.get()); 244 base::StringPrintf("%s-%p", type_name.c_str(), gles2_impl_.get());
245 ContextGL()->TraceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); 245 ContextGL()->TraceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str());
246 // If support_locking_ is true, the context may be used from multiple 246 // If support_locking_ is true, the context may be used from multiple
247 // threads, and any async callstacks will need to hold the same lock, so 247 // threads, and any async callstacks will need to hold the same lock, so
248 // give it to the command buffer. 248 // give it to the command buffer and cache controller.
249 // We don't hold a lock here since there's no need, so set the lock very last 249 // We don't hold a lock here since there's no need, so set the lock very last
250 // to prevent asserts that we're not holding it. 250 // to prevent asserts that we're not holding it.
251 if (support_locking_) 251 if (support_locking_) {
252 command_buffer_->SetLock(&context_lock_); 252 command_buffer_->SetLock(&context_lock_);
253 cache_controller_->SetLock(&context_lock_);
254 }
253 return true; 255 return true;
254 } 256 }
255 257
256 void ContextProviderCommandBuffer::DetachFromThread() { 258 void ContextProviderCommandBuffer::DetachFromThread() {
257 context_thread_checker_.DetachFromThread(); 259 context_thread_checker_.DetachFromThread();
258 } 260 }
259 261
260 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { 262 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() {
261 DCHECK(bind_succeeded_); 263 DCHECK(bind_succeeded_);
262 DCHECK(context_thread_checker_.CalledOnValidThread()); 264 DCHECK(context_thread_checker_.CalledOnValidThread());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 336
335 void ContextProviderCommandBuffer::SetLostContextCallback( 337 void ContextProviderCommandBuffer::SetLostContextCallback(
336 const LostContextCallback& lost_context_callback) { 338 const LostContextCallback& lost_context_callback) {
337 DCHECK(context_thread_checker_.CalledOnValidThread()); 339 DCHECK(context_thread_checker_.CalledOnValidThread());
338 DCHECK(lost_context_callback_.is_null() || 340 DCHECK(lost_context_callback_.is_null() ||
339 lost_context_callback.is_null()); 341 lost_context_callback.is_null());
340 lost_context_callback_ = lost_context_callback; 342 lost_context_callback_ = lost_context_callback;
341 } 343 }
342 344
343 } // namespace content 345 } // namespace content
OLDNEW
« cc/output/context_cache_controller_unittest.cc ('K') | « cc/output/context_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698