OLD | NEW |
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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 if (!frame_connector_) | 331 if (!frame_connector_) |
332 return; | 332 return; |
333 if ((event.type == blink::WebInputEvent::GestureScrollUpdate && | 333 if ((event.type == blink::WebInputEvent::GestureScrollUpdate && |
334 not_consumed) || | 334 not_consumed) || |
335 event.type == blink::WebInputEvent::GestureScrollEnd) | 335 event.type == blink::WebInputEvent::GestureScrollEnd) |
336 frame_connector_->BubbleScrollEvent(event); | 336 frame_connector_->BubbleScrollEvent(event); |
337 } | 337 } |
338 | 338 |
339 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, | 339 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, |
340 cc::SurfaceDrawStatus drawn) { | 340 cc::SurfaceDrawStatus drawn) { |
341 cc::CompositorFrameAck ack; | |
342 DCHECK_GT(ack_pending_count_, 0U); | 341 DCHECK_GT(ack_pending_count_, 0U); |
343 | |
344 if (!surface_returned_resources_.empty()) | |
345 ack.resources.swap(surface_returned_resources_); | |
346 if (host_) { | 342 if (host_) { |
347 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), | 343 host_->Send(new ViewMsg_ReclaimCompositorResources( |
348 output_surface_id, ack)); | 344 host_->GetRoutingID(), output_surface_id, true /* is_swap_ack */, |
| 345 surface_returned_resources_)); |
| 346 surface_returned_resources_.clear(); |
349 } | 347 } |
350 ack_pending_count_--; | 348 ack_pending_count_--; |
351 } | 349 } |
352 | 350 |
353 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( | 351 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( |
354 uint32_t output_surface_id, | 352 uint32_t output_surface_id, |
355 cc::CompositorFrame frame) { | 353 cc::CompositorFrame frame) { |
356 TRACE_EVENT0("content", | 354 TRACE_EVENT0("content", |
357 "RenderWidgetHostViewChildFrame::OnSwapCompositorFrame"); | 355 "RenderWidgetHostViewChildFrame::OnSwapCompositorFrame"); |
358 | 356 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 return false; | 602 return false; |
605 } | 603 } |
606 | 604 |
607 // cc::SurfaceFactoryClient implementation. | 605 // cc::SurfaceFactoryClient implementation. |
608 void RenderWidgetHostViewChildFrame::ReturnResources( | 606 void RenderWidgetHostViewChildFrame::ReturnResources( |
609 const cc::ReturnedResourceArray& resources) { | 607 const cc::ReturnedResourceArray& resources) { |
610 if (resources.empty()) | 608 if (resources.empty()) |
611 return; | 609 return; |
612 | 610 |
613 if (!ack_pending_count_ && host_) { | 611 if (!ack_pending_count_ && host_) { |
614 cc::CompositorFrameAck ack; | |
615 std::copy(resources.begin(), resources.end(), | |
616 std::back_inserter(ack.resources)); | |
617 host_->Send(new ViewMsg_ReclaimCompositorResources( | 612 host_->Send(new ViewMsg_ReclaimCompositorResources( |
618 host_->GetRoutingID(), last_output_surface_id_, ack)); | 613 host_->GetRoutingID(), last_output_surface_id_, true /* is_swap_ack */, |
| 614 resources)); |
619 return; | 615 return; |
620 } | 616 } |
621 | 617 |
622 std::copy(resources.begin(), resources.end(), | 618 std::copy(resources.begin(), resources.end(), |
623 std::back_inserter(surface_returned_resources_)); | 619 std::back_inserter(surface_returned_resources_)); |
624 } | 620 } |
625 | 621 |
626 void RenderWidgetHostViewChildFrame::SetBeginFrameSource( | 622 void RenderWidgetHostViewChildFrame::SetBeginFrameSource( |
627 cc::BeginFrameSource* source) { | 623 cc::BeginFrameSource* source) { |
628 if (begin_frame_source_ && observing_begin_frame_source_) | 624 if (begin_frame_source_ && observing_begin_frame_source_) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 673 |
678 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 674 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
679 return true; | 675 return true; |
680 } | 676 } |
681 | 677 |
682 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 678 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
683 return surface_id_; | 679 return surface_id_; |
684 }; | 680 }; |
685 | 681 |
686 } // namespace content | 682 } // namespace content |
OLD | NEW |