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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 namespace content { | 39 namespace content { |
40 | 40 |
41 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( | 41 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( |
42 RenderWidgetHost* widget_host) | 42 RenderWidgetHost* widget_host) |
43 : host_(RenderWidgetHostImpl::From(widget_host)), | 43 : host_(RenderWidgetHostImpl::From(widget_host)), |
44 next_surface_sequence_(1u), | 44 next_surface_sequence_(1u), |
45 last_output_surface_id_(0), | 45 last_output_surface_id_(0), |
46 current_surface_scale_factor_(1.f), | 46 current_surface_scale_factor_(1.f), |
47 ack_pending_count_(0), | 47 ack_pending_count_(0), |
| 48 surface_frame_count_(0), |
48 frame_connector_(nullptr), | 49 frame_connector_(nullptr), |
49 begin_frame_source_(nullptr), | 50 begin_frame_source_(nullptr), |
50 observing_begin_frame_source_(false), | 51 observing_begin_frame_source_(false), |
51 parent_surface_id_namespace_(0), | 52 parent_surface_id_namespace_(0), |
52 weak_factory_(this) { | 53 weak_factory_(this) { |
53 id_allocator_ = CreateSurfaceIdAllocator(); | 54 id_allocator_ = CreateSurfaceIdAllocator(); |
54 RegisterSurfaceNamespaceId(); | 55 RegisterSurfaceNamespaceId(); |
55 | 56 |
56 host_->SetView(this); | 57 host_->SetView(this); |
57 } | 58 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 // forward GestureScrollUpdate. | 346 // forward GestureScrollUpdate. |
346 if (frame_connector_ && | 347 if (frame_connector_ && |
347 event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed) | 348 event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed) |
348 frame_connector_->BubbleScrollEvent(event); | 349 frame_connector_->BubbleScrollEvent(event); |
349 } | 350 } |
350 | 351 |
351 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, | 352 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, |
352 cc::SurfaceDrawStatus drawn) { | 353 cc::SurfaceDrawStatus drawn) { |
353 cc::CompositorFrameAck ack; | 354 cc::CompositorFrameAck ack; |
354 DCHECK_GT(ack_pending_count_, 0U); | 355 DCHECK_GT(ack_pending_count_, 0U); |
| 356 |
| 357 surface_frame_count_++; |
| 358 |
355 if (!surface_returned_resources_.empty()) | 359 if (!surface_returned_resources_.empty()) |
356 ack.resources.swap(surface_returned_resources_); | 360 ack.resources.swap(surface_returned_resources_); |
357 if (host_) { | 361 if (host_) { |
358 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), | 362 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), |
359 output_surface_id, ack)); | 363 output_surface_id, ack)); |
360 } | 364 } |
361 ack_pending_count_--; | 365 ack_pending_count_--; |
362 } | 366 } |
363 | 367 |
364 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( | 368 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( | 681 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( |
678 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { | 682 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { |
679 return BrowserAccessibilityManager::Create( | 683 return BrowserAccessibilityManager::Create( |
680 BrowserAccessibilityManager::GetEmptyDocument(), delegate); | 684 BrowserAccessibilityManager::GetEmptyDocument(), delegate); |
681 } | 685 } |
682 | 686 |
683 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 687 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
684 if (surface_factory_ && !surface_id_.is_null()) | 688 if (surface_factory_ && !surface_id_.is_null()) |
685 surface_factory_->Destroy(surface_id_); | 689 surface_factory_->Destroy(surface_id_); |
686 surface_id_ = cc::SurfaceId(); | 690 surface_id_ = cc::SurfaceId(); |
| 691 surface_frame_count_ = 0; |
687 } | 692 } |
688 | 693 |
689 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 694 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
690 return true; | 695 return true; |
691 } | 696 } |
692 | 697 |
693 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 698 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
694 return surface_id_; | 699 return surface_id_; |
695 }; | 700 }; |
696 | 701 |
697 } // namespace content | 702 } // namespace content |
OLD | NEW |