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

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

Issue 2252163003: Update Context Client Visibility to use Scoped Pattern (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix webview 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 DCHECK(context_thread_checker_.CalledOnValidThread()); 307 DCHECK(context_thread_checker_.CalledOnValidThread());
308 // Skips past the trace_impl_ as it doesn't have capabilities. 308 // Skips past the trace_impl_ as it doesn't have capabilities.
309 return gles2_impl_->capabilities(); 309 return gles2_impl_->capabilities();
310 } 310 }
311 311
312 void ContextProviderCommandBuffer::DeleteCachedResources() { 312 void ContextProviderCommandBuffer::DeleteCachedResources() {
313 DCHECK(context_thread_checker_.CalledOnValidThread()); 313 DCHECK(context_thread_checker_.CalledOnValidThread());
314 314
315 if (gr_context_) 315 if (gr_context_)
316 gr_context_->FreeGpuResources(); 316 gr_context_->FreeGpuResources();
317
318 ContextSupport()->TrimResources();
317 } 319 }
318 320
319 void ContextProviderCommandBuffer::OnLostContext() { 321 void ContextProviderCommandBuffer::OnLostContext() {
320 DCHECK(context_thread_checker_.CalledOnValidThread()); 322 DCHECK(context_thread_checker_.CalledOnValidThread());
321 323
322 if (!lost_context_callback_.is_null()) 324 if (!lost_context_callback_.is_null())
323 lost_context_callback_.Run(); 325 lost_context_callback_.Run();
324 if (gr_context_) 326 if (gr_context_)
325 gr_context_->OnLostContext(); 327 gr_context_->OnLostContext();
326 328
327 gpu::CommandBuffer::State state = GetCommandBufferProxy()->GetLastState(); 329 gpu::CommandBuffer::State state = GetCommandBufferProxy()->GetLastState();
328 command_buffer_metrics::UmaRecordContextLost(context_type_, state.error, 330 command_buffer_metrics::UmaRecordContextLost(context_type_, state.error,
329 state.context_lost_reason); 331 state.context_lost_reason);
330 } 332 }
331 333
332 void ContextProviderCommandBuffer::SetLostContextCallback( 334 void ContextProviderCommandBuffer::SetLostContextCallback(
333 const LostContextCallback& lost_context_callback) { 335 const LostContextCallback& lost_context_callback) {
334 DCHECK(context_thread_checker_.CalledOnValidThread()); 336 DCHECK(context_thread_checker_.CalledOnValidThread());
335 DCHECK(lost_context_callback_.is_null() || 337 DCHECK(lost_context_callback_.is_null() ||
336 lost_context_callback.is_null()); 338 lost_context_callback.is_null());
337 lost_context_callback_ = lost_context_callback; 339 lost_context_callback_ = lost_context_callback;
338 } 340 }
339 341
340 } // namespace content 342 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | content/renderer/android/synchronous_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698