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

Side by Side Diff: content/renderer/android/synchronous_compositor_output_surface.cc

Issue 2147873003: cc: Dedup IPCs to return resources to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 if (did_swap_) { 334 if (did_swap_) {
335 // This must happen after unwinding the stack and leaving the compositor. 335 // This must happen after unwinding the stack and leaving the compositor.
336 // Usually it is a separate task but we just defer it until OnDraw completes 336 // Usually it is a separate task but we just defer it until OnDraw completes
337 // instead. 337 // instead.
338 client_->DidSwapBuffersComplete(); 338 client_->DidSwapBuffersComplete();
339 } 339 }
340 } 340 }
341 341
342 void SynchronousCompositorOutputSurface::OnReclaimResources( 342 void SynchronousCompositorOutputSurface::OnReclaimResources(
343 uint32_t output_surface_id, 343 uint32_t output_surface_id,
344 const cc::CompositorFrameAck& ack) { 344 const cc::ReturnedResourceArray& resources) {
345 // Ignore message if it's a stale one coming from a different output surface 345 // Ignore message if it's a stale one coming from a different output surface
346 // (e.g. after a lost context). 346 // (e.g. after a lost context).
347 if (output_surface_id != output_surface_id_) 347 if (output_surface_id != output_surface_id_)
348 return; 348 return;
349 ReclaimResources(&ack); 349 ReclaimResources(resources);
350 } 350 }
351 351
352 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) { 352 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) {
353 DCHECK(CalledOnValidThread()); 353 DCHECK(CalledOnValidThread());
354 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit; 354 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit;
355 bool became_non_zero = 355 bool became_non_zero =
356 !memory_policy_.bytes_limit_when_visible && bytes_limit; 356 !memory_policy_.bytes_limit_when_visible && bytes_limit;
357 memory_policy_.bytes_limit_when_visible = bytes_limit; 357 memory_policy_.bytes_limit_when_visible = bytes_limit;
358 memory_policy_.num_resources_limit = kNumResourcesLimit; 358 memory_policy_.num_resources_limit = kNumResourcesLimit;
359 359
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return sender_->Send(message); 393 return sender_->Send(message);
394 } 394 }
395 395
396 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 396 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
397 return thread_checker_.CalledOnValidThread(); 397 return thread_checker_.CalledOnValidThread();
398 } 398 }
399 399
400 void SynchronousCompositorOutputSurface::ReturnResources( 400 void SynchronousCompositorOutputSurface::ReturnResources(
401 const cc::ReturnedResourceArray& resources) { 401 const cc::ReturnedResourceArray& resources) {
402 DCHECK(resources.empty()); 402 DCHECK(resources.empty());
403 cc::CompositorFrameAck ack; 403 client_->ReclaimResources(resources);
404 client_->ReclaimResources(&ack);
405 } 404 }
406 405
407 void SynchronousCompositorOutputSurface::SetBeginFrameSource( 406 void SynchronousCompositorOutputSurface::SetBeginFrameSource(
408 cc::BeginFrameSource* begin_frame_source) { 407 cc::BeginFrameSource* begin_frame_source) {
409 // Software output is synchronous and doesn't use a BeginFrameSource. 408 // Software output is synchronous and doesn't use a BeginFrameSource.
410 NOTREACHED(); 409 NOTREACHED();
411 } 410 }
412 411
413 } // namespace content 412 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698