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/renderer/android/synchronous_compositor_output_surface.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 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 "content/renderer/android/synchronous_compositor_output_surface.h" 5 #include "content/renderer/android/synchronous_compositor_output_surface.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Ignore message if it's a stale one coming from a different output surface 361 // Ignore message if it's a stale one coming from a different output surface
362 // (e.g. after a lost context). 362 // (e.g. after a lost context).
363 if (output_surface_id != output_surface_id_) 363 if (output_surface_id != output_surface_id_)
364 return; 364 return;
365 ReclaimResources(resources); 365 ReclaimResources(resources);
366 } 366 }
367 367
368 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) { 368 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) {
369 DCHECK(CalledOnValidThread()); 369 DCHECK(CalledOnValidThread());
370 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit; 370 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit;
371 bool became_non_zero =
372 !memory_policy_.bytes_limit_when_visible && bytes_limit;
373 memory_policy_.bytes_limit_when_visible = bytes_limit; 371 memory_policy_.bytes_limit_when_visible = bytes_limit;
374 memory_policy_.num_resources_limit = kNumResourcesLimit; 372 memory_policy_.num_resources_limit = kNumResourcesLimit;
375 373
376 if (client_) 374 if (client_)
377 client_->SetMemoryPolicy(memory_policy_); 375 client_->SetMemoryPolicy(memory_policy_);
378 376
379 if (became_zero) { 377 if (became_zero) {
380 // This is small hack to drop context resources without destroying it 378 // This is small hack to drop context resources without destroying it
381 // when this compositor is put into the background. 379 // when this compositor is put into the background.
382 context_provider()->ContextSupport()->SetAggressivelyFreeResources( 380 context_provider()->DeleteCachedResources();
383 true /* aggressively_free_resources */);
384 } else if (became_non_zero) {
385 context_provider()->ContextSupport()->SetAggressivelyFreeResources(
386 false /* aggressively_free_resources */);
387 } 381 }
388 } 382 }
389 383
390 void SynchronousCompositorOutputSurface::DidActivatePendingTree() { 384 void SynchronousCompositorOutputSurface::DidActivatePendingTree() {
391 DCHECK(CalledOnValidThread()); 385 DCHECK(CalledOnValidThread());
392 if (sync_client_) 386 if (sync_client_)
393 sync_client_->DidActivatePendingTree(); 387 sync_client_->DidActivatePendingTree();
394 DeliverMessages(); 388 DeliverMessages();
395 } 389 }
396 390
(...skipping 22 matching lines...) Expand all
419 client_->ReclaimResources(resources); 413 client_->ReclaimResources(resources);
420 } 414 }
421 415
422 void SynchronousCompositorOutputSurface::SetBeginFrameSource( 416 void SynchronousCompositorOutputSurface::SetBeginFrameSource(
423 cc::BeginFrameSource* begin_frame_source) { 417 cc::BeginFrameSource* begin_frame_source) {
424 // Software output is synchronous and doesn't use a BeginFrameSource. 418 // Software output is synchronous and doesn't use a BeginFrameSource.
425 NOTREACHED(); 419 NOTREACHED();
426 } 420 }
427 421
428 } // namespace content 422 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/context_provider_command_buffer.cc ('k') | gpu/command_buffer/client/context_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698