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

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: Add bool is_swap_ack + remove CompositorFrameAck 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); 331 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0);
332 did_swap_ = false; 332 did_swap_ = false;
333 client_->OnDraw(adjusted_transform, viewport, clip, in_software_draw_); 333 client_->OnDraw(adjusted_transform, viewport, clip, in_software_draw_);
334 334
335 if (did_swap_) 335 if (did_swap_)
336 client_->DidSwapBuffersComplete(); 336 client_->DidSwapBuffersComplete();
337 } 337 }
338 338
339 void SynchronousCompositorOutputSurface::OnReclaimResources( 339 void SynchronousCompositorOutputSurface::OnReclaimResources(
340 uint32_t output_surface_id, 340 uint32_t output_surface_id,
341 const cc::CompositorFrameAck& ack) { 341 const cc::ReturnedResourceArray& resources) {
342 // Ignore message if it's a stale one coming from a different output surface 342 // Ignore message if it's a stale one coming from a different output surface
343 // (e.g. after a lost context). 343 // (e.g. after a lost context).
344 if (output_surface_id != output_surface_id_) 344 if (output_surface_id != output_surface_id_)
345 return; 345 return;
346 ReclaimResources(&ack); 346 ReclaimResources(resources);
347 } 347 }
348 348
349 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) { 349 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) {
350 DCHECK(CalledOnValidThread()); 350 DCHECK(CalledOnValidThread());
351 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit; 351 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit;
352 bool became_non_zero = 352 bool became_non_zero =
353 !memory_policy_.bytes_limit_when_visible && bytes_limit; 353 !memory_policy_.bytes_limit_when_visible && bytes_limit;
354 memory_policy_.bytes_limit_when_visible = bytes_limit; 354 memory_policy_.bytes_limit_when_visible = bytes_limit;
355 memory_policy_.num_resources_limit = kNumResourcesLimit; 355 memory_policy_.num_resources_limit = kNumResourcesLimit;
356 356
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 return sender_->Send(message); 390 return sender_->Send(message);
391 } 391 }
392 392
393 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 393 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
394 return thread_checker_.CalledOnValidThread(); 394 return thread_checker_.CalledOnValidThread();
395 } 395 }
396 396
397 void SynchronousCompositorOutputSurface::ReturnResources( 397 void SynchronousCompositorOutputSurface::ReturnResources(
398 const cc::ReturnedResourceArray& resources) { 398 const cc::ReturnedResourceArray& resources) {
399 DCHECK(resources.empty()); 399 DCHECK(resources.empty());
400 cc::CompositorFrameAck ack; 400 client_->ReclaimResources(resources);
401 client_->ReclaimResources(&ack);
402 } 401 }
403 402
404 void SynchronousCompositorOutputSurface::SetBeginFrameSource( 403 void SynchronousCompositorOutputSurface::SetBeginFrameSource(
405 cc::BeginFrameSource* begin_frame_source) { 404 cc::BeginFrameSource* begin_frame_source) {
406 // Software output is synchronous and doesn't use a BeginFrameSource. 405 // Software output is synchronous and doesn't use a BeginFrameSource.
407 NOTREACHED(); 406 NOTREACHED();
408 } 407 }
409 408
410 } // namespace content 409 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698