| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( | 50 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( |
| 51 RenderWidgetHost* widget_host) | 51 RenderWidgetHost* widget_host) |
| 52 : host_(RenderWidgetHostImpl::From(widget_host)), | 52 : host_(RenderWidgetHostImpl::From(widget_host)), |
| 53 frame_sink_id_( | 53 frame_sink_id_( |
| 54 base::checked_cast<uint32_t>(widget_host->GetProcess()->GetID()), | 54 base::checked_cast<uint32_t>(widget_host->GetProcess()->GetID()), |
| 55 base::checked_cast<uint32_t>(widget_host->GetRoutingID())), | 55 base::checked_cast<uint32_t>(widget_host->GetRoutingID())), |
| 56 next_surface_sequence_(1u), | 56 next_surface_sequence_(1u), |
| 57 last_compositor_frame_sink_id_(0), | 57 last_compositor_frame_sink_id_(0), |
| 58 current_surface_scale_factor_(1.f), | 58 current_surface_scale_factor_(1.f), |
| 59 ack_pending_count_(0), | |
| 60 frame_connector_(nullptr), | 59 frame_connector_(nullptr), |
| 61 begin_frame_source_(nullptr), | |
| 62 weak_factory_(this) { | 60 weak_factory_(this) { |
| 63 id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); | 61 id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); |
| 64 auto* manager = GetSurfaceManager(); | 62 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 65 manager->RegisterFrameSinkId(frame_sink_id_); | 63 CreateCompositorFrameSinkSupport(); |
| 66 surface_factory_ = | |
| 67 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); | |
| 68 } | 64 } |
| 69 | 65 |
| 70 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { | 66 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() = default; |
| 71 surface_factory_->EvictSurface(); | |
| 72 if (GetSurfaceManager()) | |
| 73 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); | |
| 74 } | |
| 75 | 67 |
| 76 void RenderWidgetHostViewChildFrame::Init() { | 68 void RenderWidgetHostViewChildFrame::Init() { |
| 77 RegisterFrameSinkId(); | 69 RegisterFrameSinkId(); |
| 78 host_->SetView(this); | 70 host_->SetView(this); |
| 79 GetTextInputManager(); | 71 GetTextInputManager(); |
| 80 } | 72 } |
| 81 | 73 |
| 74 void RenderWidgetHostViewChildFrame::ResetCompositorFrameSinkSupport() { |
| 75 if (!support_) |
| 76 return; |
| 77 if (parent_frame_sink_id_.is_valid()) { |
| 78 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, |
| 79 frame_sink_id_); |
| 80 } |
| 81 support_.reset(); |
| 82 } |
| 83 |
| 84 void RenderWidgetHostViewChildFrame::CreateCompositorFrameSinkSupport() { |
| 85 DCHECK(!support_); |
| 86 support_ = base::MakeUnique<cc::CompositorFrameSinkSupport>( |
| 87 this, GetSurfaceManager(), frame_sink_id_, false /* is_root */, |
| 88 false /* handles_frame_sink_id_invalidation */, |
| 89 true /* needs_sync_points */); |
| 90 if (parent_frame_sink_id_.is_valid()) { |
| 91 GetSurfaceManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_, |
| 92 frame_sink_id_); |
| 93 } |
| 94 if (needs_begin_frame_) |
| 95 support_->SetNeedsBeginFrame(needs_begin_frame_); |
| 96 } |
| 97 |
| 82 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( | 98 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( |
| 83 CrossProcessFrameConnector* frame_connector) { | 99 CrossProcessFrameConnector* frame_connector) { |
| 84 if (frame_connector_ == frame_connector) | 100 if (frame_connector_ == frame_connector) |
| 85 return; | 101 return; |
| 86 | 102 |
| 87 if (frame_connector_) { | 103 if (frame_connector_) { |
| 88 if (parent_frame_sink_id_.is_valid()) { | 104 ResetCompositorFrameSinkSupport(); |
| 89 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, | |
| 90 frame_sink_id_); | |
| 91 } | |
| 92 // Unregister the client here, as it is not guaranteed in tests that the | |
| 93 // destructor will be called. | |
| 94 GetSurfaceManager()->UnregisterSurfaceFactoryClient(frame_sink_id_); | |
| 95 | |
| 96 parent_frame_sink_id_ = cc::FrameSinkId(); | 105 parent_frame_sink_id_ = cc::FrameSinkId(); |
| 97 | 106 |
| 98 // After the RenderWidgetHostViewChildFrame loses the frame_connector, it | |
| 99 // won't be able to walk up the frame tree anymore. Clean up anything that | |
| 100 // needs to be done through the CrossProcessFrameConnector before it's gone. | |
| 101 | |
| 102 // Unlocks the mouse if this RenderWidgetHostView holds the lock. | 107 // Unlocks the mouse if this RenderWidgetHostView holds the lock. |
| 103 UnlockMouse(); | 108 UnlockMouse(); |
| 104 } | 109 } |
| 105 frame_connector_ = frame_connector; | 110 frame_connector_ = frame_connector; |
| 106 if (frame_connector_) { | 111 if (frame_connector_) { |
| 107 GetSurfaceManager()->RegisterSurfaceFactoryClient(frame_sink_id_, this); | 112 ResetCompositorFrameSinkSupport(); |
| 108 RenderWidgetHostViewBase* parent_view = | 113 RenderWidgetHostViewBase* parent_view = |
| 109 frame_connector_->GetParentRenderWidgetHostView(); | 114 frame_connector_->GetParentRenderWidgetHostView(); |
| 110 if (parent_view) { | 115 if (parent_view) { |
| 111 parent_frame_sink_id_ = parent_view->GetFrameSinkId(); | 116 parent_frame_sink_id_ = parent_view->GetFrameSinkId(); |
| 112 DCHECK(parent_frame_sink_id_.is_valid()); | 117 DCHECK(parent_frame_sink_id_.is_valid()); |
| 113 GetSurfaceManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_, | |
| 114 frame_sink_id_); | |
| 115 } | 118 } |
| 119 CreateCompositorFrameSinkSupport(); |
| 116 } | 120 } |
| 117 } | 121 } |
| 118 | 122 |
| 119 void RenderWidgetHostViewChildFrame::InitAsChild( | 123 void RenderWidgetHostViewChildFrame::InitAsChild( |
| 120 gfx::NativeView parent_view) { | 124 gfx::NativeView parent_view) { |
| 121 NOTREACHED(); | 125 NOTREACHED(); |
| 122 } | 126 } |
| 123 | 127 |
| 124 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const { | 128 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const { |
| 125 return host_; | 129 return host_; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 SetCrossProcessFrameConnector(nullptr); | 292 SetCrossProcessFrameConnector(nullptr); |
| 289 } | 293 } |
| 290 | 294 |
| 291 // We notify our observers about shutdown here since we are about to release | 295 // We notify our observers about shutdown here since we are about to release |
| 292 // host_ and do not want any event calls coming from | 296 // host_ and do not want any event calls coming from |
| 293 // RenderWidgetHostInputEventRouter afterwards. | 297 // RenderWidgetHostInputEventRouter afterwards. |
| 294 NotifyObserversAboutShutdown(); | 298 NotifyObserversAboutShutdown(); |
| 295 | 299 |
| 296 host_->SetView(nullptr); | 300 host_->SetView(nullptr); |
| 297 host_ = nullptr; | 301 host_ = nullptr; |
| 302 |
| 303 ResetCompositorFrameSinkSupport(); |
| 304 if (GetSurfaceManager()) |
| 305 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); |
| 306 |
| 298 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | 307 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
| 299 } | 308 } |
| 300 | 309 |
| 301 void RenderWidgetHostViewChildFrame::SetTooltipText( | 310 void RenderWidgetHostViewChildFrame::SetTooltipText( |
| 302 const base::string16& tooltip_text) { | 311 const base::string16& tooltip_text) { |
| 303 frame_connector_->GetRootRenderWidgetHostView()->SetTooltipText(tooltip_text); | 312 frame_connector_->GetRootRenderWidgetHostView()->SetTooltipText(tooltip_text); |
| 304 } | 313 } |
| 305 | 314 |
| 306 RenderWidgetHostViewBase* RenderWidgetHostViewChildFrame::GetParentView() { | 315 RenderWidgetHostViewBase* RenderWidgetHostViewChildFrame::GetParentView() { |
| 307 if (!frame_connector_) | 316 if (!frame_connector_) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // always forwarded and handled according to current scroll state in the | 355 // always forwarded and handled according to current scroll state in the |
| 347 // RenderWidgetHostInputEventRouter. | 356 // RenderWidgetHostInputEventRouter. |
| 348 if (!frame_connector_) | 357 if (!frame_connector_) |
| 349 return; | 358 return; |
| 350 if ((event.type() == blink::WebInputEvent::GestureScrollUpdate && | 359 if ((event.type() == blink::WebInputEvent::GestureScrollUpdate && |
| 351 not_consumed) || | 360 not_consumed) || |
| 352 event.type() == blink::WebInputEvent::GestureScrollEnd) | 361 event.type() == blink::WebInputEvent::GestureScrollEnd) |
| 353 frame_connector_->BubbleScrollEvent(event); | 362 frame_connector_->BubbleScrollEvent(event); |
| 354 } | 363 } |
| 355 | 364 |
| 356 void RenderWidgetHostViewChildFrame::SurfaceDrawn( | 365 void RenderWidgetHostViewChildFrame::DidReceiveCompositorFrameAck() { |
| 357 uint32_t compositor_frame_sink_id) { | 366 if (!host_) |
| 358 DCHECK_GT(ack_pending_count_, 0U); | 367 return; |
| 359 if (host_) { | 368 host_->Send(new ViewMsg_ReclaimCompositorResources( |
| 360 host_->Send(new ViewMsg_ReclaimCompositorResources( | 369 host_->GetRoutingID(), last_compositor_frame_sink_id_, |
| 361 host_->GetRoutingID(), compositor_frame_sink_id, true /* is_swap_ack */, | 370 true /* is_swap_ack */, cc::ReturnedResourceArray())); |
| 362 surface_returned_resources_)); | |
| 363 surface_returned_resources_.clear(); | |
| 364 } | |
| 365 ack_pending_count_--; | |
| 366 } | 371 } |
| 367 | 372 |
| 368 bool RenderWidgetHostViewChildFrame::ShouldCreateNewSurfaceId( | 373 bool RenderWidgetHostViewChildFrame::ShouldCreateNewSurfaceId( |
| 369 uint32_t compositor_frame_sink_id, | 374 uint32_t compositor_frame_sink_id, |
| 370 const cc::CompositorFrame& frame) { | 375 const cc::CompositorFrame& frame) { |
| 371 gfx::Size new_frame_size = frame.render_pass_list.back()->output_rect.size(); | 376 gfx::Size new_frame_size = frame.render_pass_list.back()->output_rect.size(); |
| 372 float new_scale_factor = frame.metadata.device_scale_factor; | 377 float new_scale_factor = frame.metadata.device_scale_factor; |
| 373 | 378 |
| 374 return compositor_frame_sink_id != last_compositor_frame_sink_id_ || | 379 return compositor_frame_sink_id != last_compositor_frame_sink_id_ || |
| 375 new_frame_size != current_surface_size_ || | 380 new_frame_size != current_surface_size_ || |
| 376 new_scale_factor != current_surface_scale_factor_; | 381 new_scale_factor != current_surface_scale_factor_; |
| 377 } | 382 } |
| 378 | 383 |
| 379 void RenderWidgetHostViewChildFrame::ProcessCompositorFrame( | 384 void RenderWidgetHostViewChildFrame::ProcessCompositorFrame( |
| 380 uint32_t compositor_frame_sink_id, | 385 uint32_t compositor_frame_sink_id, |
| 381 cc::CompositorFrame frame) { | 386 cc::CompositorFrame frame) { |
| 382 if (ShouldCreateNewSurfaceId(compositor_frame_sink_id, frame)) { | 387 if (ShouldCreateNewSurfaceId(compositor_frame_sink_id, frame)) { |
| 383 ClearCompositorSurfaceIfNecessary(); | 388 ClearCompositorSurfaceIfNecessary(); |
| 384 // If the renderer changed its frame sink, reset the surface factory to | 389 // If the renderer changed its frame sink, reset the |
| 385 // avoid returning stale resources. | 390 // CompositorFrameSinkSupport to avoid returning stale resources. |
| 386 if (compositor_frame_sink_id != last_compositor_frame_sink_id_) | 391 if (compositor_frame_sink_id != last_compositor_frame_sink_id_) { |
| 387 surface_factory_->Reset(); | 392 ResetCompositorFrameSinkSupport(); |
| 393 CreateCompositorFrameSinkSupport(); |
| 394 } |
| 388 last_compositor_frame_sink_id_ = compositor_frame_sink_id; | 395 last_compositor_frame_sink_id_ = compositor_frame_sink_id; |
| 389 current_surface_size_ = frame.render_pass_list.back()->output_rect.size(); | 396 current_surface_size_ = frame.render_pass_list.back()->output_rect.size(); |
| 390 current_surface_scale_factor_ = frame.metadata.device_scale_factor; | 397 current_surface_scale_factor_ = frame.metadata.device_scale_factor; |
| 391 } | 398 } |
| 392 | 399 |
| 393 bool allocated_new_local_surface_id = false; | 400 bool allocated_new_local_surface_id = false; |
| 394 if (!local_surface_id_.is_valid()) { | 401 if (!local_surface_id_.is_valid()) { |
| 395 local_surface_id_ = id_allocator_->GenerateId(); | 402 local_surface_id_ = id_allocator_->GenerateId(); |
| 396 allocated_new_local_surface_id = true; | 403 allocated_new_local_surface_id = true; |
| 397 } | 404 } |
| 398 | 405 |
| 399 cc::SurfaceFactory::DrawCallback ack_callback = | 406 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); |
| 400 base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(), | |
| 401 compositor_frame_sink_id); | |
| 402 ack_pending_count_++; | |
| 403 // If this value grows very large, something is going wrong. | |
| 404 DCHECK_LT(ack_pending_count_, 1000U); | |
| 405 surface_factory_->SubmitCompositorFrame(local_surface_id_, std::move(frame), | |
| 406 ack_callback); | |
| 407 if (allocated_new_local_surface_id) | 407 if (allocated_new_local_surface_id) |
| 408 SendSurfaceInfoToEmbedder(); | 408 SendSurfaceInfoToEmbedder(); |
| 409 ProcessFrameSwappedCallbacks(); | 409 ProcessFrameSwappedCallbacks(); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() { | 412 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() { |
| 413 cc::SurfaceSequence sequence = | 413 cc::SurfaceSequence sequence = |
| 414 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); | 414 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); |
| 415 cc::SurfaceManager* manager = GetSurfaceManager(); | 415 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 416 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); | 416 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 SubmitSurfaceCopyRequest(src_subrect, output_size, callback, | 619 SubmitSurfaceCopyRequest(src_subrect, output_size, callback, |
| 620 preferred_color_type); | 620 preferred_color_type); |
| 621 } | 621 } |
| 622 | 622 |
| 623 void RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest( | 623 void RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest( |
| 624 const gfx::Rect& src_subrect, | 624 const gfx::Rect& src_subrect, |
| 625 const gfx::Size& output_size, | 625 const gfx::Size& output_size, |
| 626 const ReadbackRequestCallback& callback, | 626 const ReadbackRequestCallback& callback, |
| 627 const SkColorType preferred_color_type) { | 627 const SkColorType preferred_color_type) { |
| 628 DCHECK(IsSurfaceAvailableForCopy()); | 628 DCHECK(IsSurfaceAvailableForCopy()); |
| 629 DCHECK(support_); |
| 629 | 630 |
| 630 std::unique_ptr<cc::CopyOutputRequest> request = | 631 std::unique_ptr<cc::CopyOutputRequest> request = |
| 631 cc::CopyOutputRequest::CreateRequest( | 632 cc::CopyOutputRequest::CreateRequest( |
| 632 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size, | 633 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size, |
| 633 preferred_color_type, callback)); | 634 preferred_color_type, callback)); |
| 634 if (!src_subrect.IsEmpty()) | 635 if (!src_subrect.IsEmpty()) |
| 635 request->set_area(src_subrect); | 636 request->set_area(src_subrect); |
| 636 | 637 |
| 637 surface_factory_->RequestCopyOfSurface(std::move(request)); | 638 support_->RequestCopyOfSurface(std::move(request)); |
| 638 } | 639 } |
| 639 | 640 |
| 640 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( | 641 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( |
| 641 const gfx::Rect& src_subrect, | 642 const gfx::Rect& src_subrect, |
| 642 const scoped_refptr<media::VideoFrame>& target, | 643 const scoped_refptr<media::VideoFrame>& target, |
| 643 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | 644 const base::Callback<void(const gfx::Rect&, bool)>& callback) { |
| 644 NOTIMPLEMENTED(); | 645 NOTIMPLEMENTED(); |
| 645 callback.Run(gfx::Rect(), false); | 646 callback.Run(gfx::Rect(), false); |
| 646 } | 647 } |
| 647 | 648 |
| 648 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { | 649 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { |
| 649 return false; | 650 return false; |
| 650 } | 651 } |
| 651 | 652 |
| 652 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( | 653 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( |
| 653 const gfx::Size& desired_size) { | 654 const gfx::Size& desired_size) { |
| 654 return false; | 655 return false; |
| 655 } | 656 } |
| 656 | 657 |
| 657 // cc::SurfaceFactoryClient implementation. | 658 void RenderWidgetHostViewChildFrame::ReclaimResources( |
| 658 void RenderWidgetHostViewChildFrame::ReturnResources( | |
| 659 const cc::ReturnedResourceArray& resources) { | 659 const cc::ReturnedResourceArray& resources) { |
| 660 if (resources.empty()) | 660 if (!host_) |
| 661 return; | 661 return; |
| 662 | 662 host_->Send(new ViewMsg_ReclaimCompositorResources( |
| 663 if (!ack_pending_count_ && host_) { | 663 host_->GetRoutingID(), last_compositor_frame_sink_id_, |
| 664 host_->Send(new ViewMsg_ReclaimCompositorResources( | 664 false /* is_swap_ack */, resources)); |
| 665 host_->GetRoutingID(), last_compositor_frame_sink_id_, | |
| 666 false /* is_swap_ack */, resources)); | |
| 667 return; | |
| 668 } | |
| 669 | |
| 670 std::copy(resources.begin(), resources.end(), | |
| 671 std::back_inserter(surface_returned_resources_)); | |
| 672 } | |
| 673 | |
| 674 void RenderWidgetHostViewChildFrame::SetBeginFrameSource( | |
| 675 cc::BeginFrameSource* source) { | |
| 676 bool needs_begin_frames = host_->needs_begin_frames(); | |
| 677 if (begin_frame_source_ && needs_begin_frames) | |
| 678 begin_frame_source_->RemoveObserver(this); | |
| 679 begin_frame_source_ = source; | |
| 680 if (begin_frame_source_ && needs_begin_frames) | |
| 681 begin_frame_source_->AddObserver(this); | |
| 682 } | 665 } |
| 683 | 666 |
| 684 void RenderWidgetHostViewChildFrame::OnBeginFrame( | 667 void RenderWidgetHostViewChildFrame::OnBeginFrame( |
| 685 const cc::BeginFrameArgs& args) { | 668 const cc::BeginFrameArgs& args) { |
| 686 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); | 669 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
| 687 last_begin_frame_args_ = args; | |
| 688 } | |
| 689 | |
| 690 const cc::BeginFrameArgs& | |
| 691 RenderWidgetHostViewChildFrame::LastUsedBeginFrameArgs() const { | |
| 692 return last_begin_frame_args_; | |
| 693 } | |
| 694 | |
| 695 void RenderWidgetHostViewChildFrame::OnBeginFrameSourcePausedChanged( | |
| 696 bool paused) { | |
| 697 // Only used on Android WebView. | |
| 698 } | 670 } |
| 699 | 671 |
| 700 void RenderWidgetHostViewChildFrame::SetNeedsBeginFrames( | 672 void RenderWidgetHostViewChildFrame::SetNeedsBeginFrames( |
| 701 bool needs_begin_frames) { | 673 bool needs_begin_frames) { |
| 702 if (!begin_frame_source_) | 674 needs_begin_frame_ = needs_begin_frames; |
| 703 return; | 675 if (support_) |
| 704 | 676 support_->SetNeedsBeginFrame(needs_begin_frames); |
| 705 if (needs_begin_frames) | |
| 706 begin_frame_source_->AddObserver(this); | |
| 707 else | |
| 708 begin_frame_source_->RemoveObserver(this); | |
| 709 } | 677 } |
| 710 | 678 |
| 711 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( | 679 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( |
| 712 const blink::WebInputEvent& input_event) { | 680 const blink::WebInputEvent& input_event) { |
| 713 if (input_event.type() == blink::WebInputEvent::GestureFlingStart) { | 681 if (input_event.type() == blink::WebInputEvent::GestureFlingStart) { |
| 714 const blink::WebGestureEvent& gesture_event = | 682 const blink::WebGestureEvent& gesture_event = |
| 715 static_cast<const blink::WebGestureEvent&>(input_event); | 683 static_cast<const blink::WebGestureEvent&>(input_event); |
| 716 // Zero-velocity touchpad flings are an Aura-specific signal that the | 684 // Zero-velocity touchpad flings are an Aura-specific signal that the |
| 717 // touchpad scroll has ended, and should not be forwarded to the renderer. | 685 // touchpad scroll has ended, and should not be forwarded to the renderer. |
| 718 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && | 686 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && |
| (...skipping 15 matching lines...) Expand all Loading... |
| 734 } | 702 } |
| 735 | 703 |
| 736 BrowserAccessibilityManager* | 704 BrowserAccessibilityManager* |
| 737 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( | 705 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( |
| 738 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { | 706 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { |
| 739 return BrowserAccessibilityManager::Create( | 707 return BrowserAccessibilityManager::Create( |
| 740 BrowserAccessibilityManager::GetEmptyDocument(), delegate); | 708 BrowserAccessibilityManager::GetEmptyDocument(), delegate); |
| 741 } | 709 } |
| 742 | 710 |
| 743 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 711 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
| 744 surface_factory_->EvictSurface(); | 712 if (support_) |
| 713 support_->EvictFrame(); |
| 745 local_surface_id_ = cc::LocalSurfaceId(); | 714 local_surface_id_ = cc::LocalSurfaceId(); |
| 746 } | 715 } |
| 747 | 716 |
| 748 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 717 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 749 return true; | 718 return true; |
| 750 } | 719 } |
| 751 | 720 |
| 752 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 721 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 753 return cc::SurfaceId(frame_sink_id_, local_surface_id_); | 722 return cc::SurfaceId(frame_sink_id_, local_surface_id_); |
| 754 }; | 723 }; |
| 755 | 724 |
| 756 } // namespace content | 725 } // namespace content |
| OLD | NEW |