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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/render_widget_host_view_child_frame.h" 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (!frame_connector_) 338 if (!frame_connector_)
339 return; 339 return;
340 if ((event.type == blink::WebInputEvent::GestureScrollUpdate && 340 if ((event.type == blink::WebInputEvent::GestureScrollUpdate &&
341 not_consumed) || 341 not_consumed) ||
342 event.type == blink::WebInputEvent::GestureScrollEnd) 342 event.type == blink::WebInputEvent::GestureScrollEnd)
343 frame_connector_->BubbleScrollEvent(event); 343 frame_connector_->BubbleScrollEvent(event);
344 } 344 }
345 345
346 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, 346 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id,
347 cc::SurfaceDrawStatus drawn) { 347 cc::SurfaceDrawStatus drawn) {
348 cc::CompositorFrameAck ack;
349 DCHECK_GT(ack_pending_count_, 0U); 348 DCHECK_GT(ack_pending_count_, 0U);
350
351 if (!surface_returned_resources_.empty())
352 ack.resources.swap(surface_returned_resources_);
353 if (host_) { 349 if (host_) {
354 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), 350 host_->Send(new ViewMsg_ReclaimCompositorResources(
355 output_surface_id, ack)); 351 host_->GetRoutingID(), output_surface_id, true /* is_swap_ack */,
352 surface_returned_resources_));
353 surface_returned_resources_.clear();
356 } 354 }
357 ack_pending_count_--; 355 ack_pending_count_--;
358 } 356 }
359 357
360 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( 358 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
361 uint32_t output_surface_id, 359 uint32_t output_surface_id,
362 cc::CompositorFrame frame) { 360 cc::CompositorFrame frame) {
363 TRACE_EVENT0("content", 361 TRACE_EVENT0("content",
364 "RenderWidgetHostViewChildFrame::OnSwapCompositorFrame"); 362 "RenderWidgetHostViewChildFrame::OnSwapCompositorFrame");
365 363
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 return false; 606 return false;
609 } 607 }
610 608
611 // cc::SurfaceFactoryClient implementation. 609 // cc::SurfaceFactoryClient implementation.
612 void RenderWidgetHostViewChildFrame::ReturnResources( 610 void RenderWidgetHostViewChildFrame::ReturnResources(
613 const cc::ReturnedResourceArray& resources) { 611 const cc::ReturnedResourceArray& resources) {
614 if (resources.empty()) 612 if (resources.empty())
615 return; 613 return;
616 614
617 if (!ack_pending_count_ && host_) { 615 if (!ack_pending_count_ && host_) {
618 cc::CompositorFrameAck ack;
619 std::copy(resources.begin(), resources.end(),
620 std::back_inserter(ack.resources));
621 host_->Send(new ViewMsg_ReclaimCompositorResources( 616 host_->Send(new ViewMsg_ReclaimCompositorResources(
622 host_->GetRoutingID(), last_output_surface_id_, ack)); 617 host_->GetRoutingID(), last_output_surface_id_, false /* is_swap_ack */,
618 resources));
623 return; 619 return;
624 } 620 }
625 621
626 std::copy(resources.begin(), resources.end(), 622 std::copy(resources.begin(), resources.end(),
627 std::back_inserter(surface_returned_resources_)); 623 std::back_inserter(surface_returned_resources_));
628 } 624 }
629 625
630 void RenderWidgetHostViewChildFrame::SetBeginFrameSource( 626 void RenderWidgetHostViewChildFrame::SetBeginFrameSource(
631 cc::BeginFrameSource* source) { 627 cc::BeginFrameSource* source) {
632 if (begin_frame_source_ && observing_begin_frame_source_) 628 if (begin_frame_source_ && observing_begin_frame_source_)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 677
682 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { 678 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const {
683 return true; 679 return true;
684 } 680 }
685 681
686 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { 682 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const {
687 return surface_id_; 683 return surface_id_;
688 }; 684 };
689 685
690 } // namespace content 686 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698