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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2688613002: RenderWidgetHostViewChildFrame should use CompositorFrameSinkSupport (Closed)
Patch Set: Cleanup Created 3 years, 9 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
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_child_frame.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
82 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( 74 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector(
83 CrossProcessFrameConnector* frame_connector) { 75 CrossProcessFrameConnector* frame_connector) {
84 if (frame_connector_ == frame_connector) 76 if (frame_connector_ == frame_connector)
85 return; 77 return;
86 78
87 if (frame_connector_) { 79 if (frame_connector_) {
88 if (parent_frame_sink_id_.is_valid()) { 80 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(); 81 parent_frame_sink_id_ = cc::FrameSinkId();
97 82
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. 83 // Unlocks the mouse if this RenderWidgetHostView holds the lock.
103 UnlockMouse(); 84 UnlockMouse();
104 } 85 }
105 frame_connector_ = frame_connector; 86 frame_connector_ = frame_connector;
106 if (frame_connector_) { 87 if (frame_connector_) {
107 GetSurfaceManager()->RegisterSurfaceFactoryClient(frame_sink_id_, this); 88 ResetCompositorFrameSinkSupport();
108 RenderWidgetHostViewBase* parent_view = 89 RenderWidgetHostViewBase* parent_view =
109 frame_connector_->GetParentRenderWidgetHostView(); 90 frame_connector_->GetParentRenderWidgetHostView();
110 if (parent_view) { 91 if (parent_view) {
111 parent_frame_sink_id_ = parent_view->GetFrameSinkId(); 92 parent_frame_sink_id_ = parent_view->GetFrameSinkId();
112 DCHECK(parent_frame_sink_id_.is_valid()); 93 DCHECK(parent_frame_sink_id_.is_valid());
113 GetSurfaceManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_,
114 frame_sink_id_);
115 } 94 }
95 CreateCompositorFrameSinkSupport();
116 } 96 }
117 } 97 }
118 98
119 void RenderWidgetHostViewChildFrame::InitAsChild( 99 void RenderWidgetHostViewChildFrame::InitAsChild(
120 gfx::NativeView parent_view) { 100 gfx::NativeView parent_view) {
121 NOTREACHED(); 101 NOTREACHED();
122 } 102 }
123 103
124 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const { 104 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const {
125 return host_; 105 return host_;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 SetCrossProcessFrameConnector(nullptr); 268 SetCrossProcessFrameConnector(nullptr);
289 } 269 }
290 270
291 // We notify our observers about shutdown here since we are about to release 271 // We notify our observers about shutdown here since we are about to release
292 // host_ and do not want any event calls coming from 272 // host_ and do not want any event calls coming from
293 // RenderWidgetHostInputEventRouter afterwards. 273 // RenderWidgetHostInputEventRouter afterwards.
294 NotifyObserversAboutShutdown(); 274 NotifyObserversAboutShutdown();
295 275
296 host_->SetView(nullptr); 276 host_->SetView(nullptr);
297 host_ = nullptr; 277 host_ = nullptr;
278
279 ResetCompositorFrameSinkSupport();
280 if (GetSurfaceManager())
281 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_);
282
298 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 283 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
299 } 284 }
300 285
301 void RenderWidgetHostViewChildFrame::SetTooltipText( 286 void RenderWidgetHostViewChildFrame::SetTooltipText(
302 const base::string16& tooltip_text) { 287 const base::string16& tooltip_text) {
303 frame_connector_->GetRootRenderWidgetHostView()->SetTooltipText(tooltip_text); 288 frame_connector_->GetRootRenderWidgetHostView()->SetTooltipText(tooltip_text);
304 } 289 }
305 290
306 RenderWidgetHostViewBase* RenderWidgetHostViewChildFrame::GetParentView() { 291 RenderWidgetHostViewBase* RenderWidgetHostViewChildFrame::GetParentView() {
307 if (!frame_connector_) 292 if (!frame_connector_)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // always forwarded and handled according to current scroll state in the 331 // always forwarded and handled according to current scroll state in the
347 // RenderWidgetHostInputEventRouter. 332 // RenderWidgetHostInputEventRouter.
348 if (!frame_connector_) 333 if (!frame_connector_)
349 return; 334 return;
350 if ((event.type() == blink::WebInputEvent::GestureScrollUpdate && 335 if ((event.type() == blink::WebInputEvent::GestureScrollUpdate &&
351 not_consumed) || 336 not_consumed) ||
352 event.type() == blink::WebInputEvent::GestureScrollEnd) 337 event.type() == blink::WebInputEvent::GestureScrollEnd)
353 frame_connector_->BubbleScrollEvent(event); 338 frame_connector_->BubbleScrollEvent(event);
354 } 339 }
355 340
356 void RenderWidgetHostViewChildFrame::SurfaceDrawn( 341 void RenderWidgetHostViewChildFrame::DidReceiveCompositorFrameAck() {
357 uint32_t compositor_frame_sink_id) { 342 if (!host_)
358 DCHECK_GT(ack_pending_count_, 0U); 343 return;
359 if (host_) { 344 host_->Send(new ViewMsg_ReclaimCompositorResources(
360 host_->Send(new ViewMsg_ReclaimCompositorResources( 345 host_->GetRoutingID(), last_compositor_frame_sink_id_,
361 host_->GetRoutingID(), compositor_frame_sink_id, true /* is_swap_ack */, 346 true /* is_swap_ack */, cc::ReturnedResourceArray()));
jbauman 2017/02/25 00:16:07 This removes the optimization to avoid sending an
Saman Sami 2017/02/25 00:30:46 Yes, I'm aware of this. I think the solution is th
362 surface_returned_resources_));
363 surface_returned_resources_.clear();
364 }
365 ack_pending_count_--;
366 } 347 }
367 348
368 bool RenderWidgetHostViewChildFrame::ShouldCreateNewSurfaceId( 349 bool RenderWidgetHostViewChildFrame::ShouldCreateNewSurfaceId(
369 uint32_t compositor_frame_sink_id, 350 uint32_t compositor_frame_sink_id,
370 const cc::CompositorFrame& frame) { 351 const cc::CompositorFrame& frame) {
371 gfx::Size new_frame_size = frame.render_pass_list.back()->output_rect.size(); 352 gfx::Size new_frame_size = frame.render_pass_list.back()->output_rect.size();
372 float new_scale_factor = frame.metadata.device_scale_factor; 353 float new_scale_factor = frame.metadata.device_scale_factor;
373 354
374 return compositor_frame_sink_id != last_compositor_frame_sink_id_ || 355 return compositor_frame_sink_id != last_compositor_frame_sink_id_ ||
375 new_frame_size != current_surface_size_ || 356 new_frame_size != current_surface_size_ ||
376 new_scale_factor != current_surface_scale_factor_; 357 new_scale_factor != current_surface_scale_factor_;
377 } 358 }
378 359
379 void RenderWidgetHostViewChildFrame::ProcessCompositorFrame( 360 void RenderWidgetHostViewChildFrame::ProcessCompositorFrame(
380 uint32_t compositor_frame_sink_id, 361 uint32_t compositor_frame_sink_id,
381 cc::CompositorFrame frame) { 362 cc::CompositorFrame frame) {
382 if (ShouldCreateNewSurfaceId(compositor_frame_sink_id, frame)) { 363 if (ShouldCreateNewSurfaceId(compositor_frame_sink_id, frame)) {
383 ClearCompositorSurfaceIfNecessary(); 364 ClearCompositorSurfaceIfNecessary();
384 // If the renderer changed its frame sink, reset the surface factory to 365 // If the renderer changed its frame sink, reset the
385 // avoid returning stale resources. 366 // CompositorFrameSinkSupport to avoid returning stale resources.
386 if (compositor_frame_sink_id != last_compositor_frame_sink_id_) 367 if (compositor_frame_sink_id != last_compositor_frame_sink_id_) {
387 surface_factory_->Reset(); 368 ResetCompositorFrameSinkSupport();
369 CreateCompositorFrameSinkSupport();
370 }
388 last_compositor_frame_sink_id_ = compositor_frame_sink_id; 371 last_compositor_frame_sink_id_ = compositor_frame_sink_id;
389 current_surface_size_ = frame.render_pass_list.back()->output_rect.size(); 372 current_surface_size_ = frame.render_pass_list.back()->output_rect.size();
390 current_surface_scale_factor_ = frame.metadata.device_scale_factor; 373 current_surface_scale_factor_ = frame.metadata.device_scale_factor;
391 } 374 }
392 375
393 bool allocated_new_local_surface_id = false; 376 bool allocated_new_local_surface_id = false;
394 if (!local_surface_id_.is_valid()) { 377 if (!local_surface_id_.is_valid()) {
395 local_surface_id_ = id_allocator_->GenerateId(); 378 local_surface_id_ = id_allocator_->GenerateId();
396 allocated_new_local_surface_id = true; 379 allocated_new_local_surface_id = true;
397 } 380 }
398 381
399 cc::SurfaceFactory::DrawCallback ack_callback = 382 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) 383 if (allocated_new_local_surface_id)
408 SendSurfaceInfoToEmbedder(); 384 SendSurfaceInfoToEmbedder();
409 ProcessFrameSwappedCallbacks(); 385 ProcessFrameSwappedCallbacks();
410 } 386 }
411 387
412 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() { 388 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() {
413 cc::SurfaceSequence sequence = 389 cc::SurfaceSequence sequence =
414 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); 390 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++);
415 cc::SurfaceManager* manager = GetSurfaceManager(); 391 cc::SurfaceManager* manager = GetSurfaceManager();
416 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); 392 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 SubmitSurfaceCopyRequest(src_subrect, output_size, callback, 595 SubmitSurfaceCopyRequest(src_subrect, output_size, callback,
620 preferred_color_type); 596 preferred_color_type);
621 } 597 }
622 598
623 void RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest( 599 void RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest(
624 const gfx::Rect& src_subrect, 600 const gfx::Rect& src_subrect,
625 const gfx::Size& output_size, 601 const gfx::Size& output_size,
626 const ReadbackRequestCallback& callback, 602 const ReadbackRequestCallback& callback,
627 const SkColorType preferred_color_type) { 603 const SkColorType preferred_color_type) {
628 DCHECK(IsSurfaceAvailableForCopy()); 604 DCHECK(IsSurfaceAvailableForCopy());
605 DCHECK(support_);
629 606
630 std::unique_ptr<cc::CopyOutputRequest> request = 607 std::unique_ptr<cc::CopyOutputRequest> request =
631 cc::CopyOutputRequest::CreateRequest( 608 cc::CopyOutputRequest::CreateRequest(
632 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size, 609 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size,
633 preferred_color_type, callback)); 610 preferred_color_type, callback));
634 if (!src_subrect.IsEmpty()) 611 if (!src_subrect.IsEmpty())
635 request->set_area(src_subrect); 612 request->set_area(src_subrect);
636 613
637 surface_factory_->RequestCopyOfSurface(std::move(request)); 614 support_->RequestCopyOfSurface(std::move(request));
638 } 615 }
639 616
640 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( 617 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
641 const gfx::Rect& src_subrect, 618 const gfx::Rect& src_subrect,
642 const scoped_refptr<media::VideoFrame>& target, 619 const scoped_refptr<media::VideoFrame>& target,
643 const base::Callback<void(const gfx::Rect&, bool)>& callback) { 620 const base::Callback<void(const gfx::Rect&, bool)>& callback) {
644 NOTIMPLEMENTED(); 621 NOTIMPLEMENTED();
645 callback.Run(gfx::Rect(), false); 622 callback.Run(gfx::Rect(), false);
646 } 623 }
647 624
648 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { 625 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
649 return false; 626 return false;
650 } 627 }
651 628
652 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( 629 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
653 const gfx::Size& desired_size) { 630 const gfx::Size& desired_size) {
654 return false; 631 return false;
655 } 632 }
656 633
657 // cc::SurfaceFactoryClient implementation. 634 void RenderWidgetHostViewChildFrame::ReclaimResources(
658 void RenderWidgetHostViewChildFrame::ReturnResources(
659 const cc::ReturnedResourceArray& resources) { 635 const cc::ReturnedResourceArray& resources) {
660 if (resources.empty()) 636 if (!host_)
661 return; 637 return;
662 638 host_->Send(new ViewMsg_ReclaimCompositorResources(
663 if (!ack_pending_count_ && host_) { 639 host_->GetRoutingID(), last_compositor_frame_sink_id_,
664 host_->Send(new ViewMsg_ReclaimCompositorResources( 640 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 } 641 }
683 642
684 void RenderWidgetHostViewChildFrame::OnBeginFrame( 643 void RenderWidgetHostViewChildFrame::OnBeginFrame(
685 const cc::BeginFrameArgs& args) { 644 const cc::BeginFrameArgs& args) {
686 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); 645 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 } 646 }
699 647
700 void RenderWidgetHostViewChildFrame::SetNeedsBeginFrames( 648 void RenderWidgetHostViewChildFrame::SetNeedsBeginFrames(
701 bool needs_begin_frames) { 649 bool needs_begin_frames) {
702 if (!begin_frame_source_) 650 needs_begin_frame_ = needs_begin_frames;
703 return; 651 if (support_)
704 652 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 } 653 }
710 654
711 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( 655 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent(
712 const blink::WebInputEvent& input_event) { 656 const blink::WebInputEvent& input_event) {
713 if (input_event.type() == blink::WebInputEvent::GestureFlingStart) { 657 if (input_event.type() == blink::WebInputEvent::GestureFlingStart) {
714 const blink::WebGestureEvent& gesture_event = 658 const blink::WebGestureEvent& gesture_event =
715 static_cast<const blink::WebGestureEvent&>(input_event); 659 static_cast<const blink::WebGestureEvent&>(input_event);
716 // Zero-velocity touchpad flings are an Aura-specific signal that the 660 // Zero-velocity touchpad flings are an Aura-specific signal that the
717 // touchpad scroll has ended, and should not be forwarded to the renderer. 661 // touchpad scroll has ended, and should not be forwarded to the renderer.
718 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && 662 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad &&
(...skipping 15 matching lines...) Expand all
734 } 678 }
735 679
736 BrowserAccessibilityManager* 680 BrowserAccessibilityManager*
737 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( 681 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
738 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { 682 BrowserAccessibilityDelegate* delegate, bool for_root_frame) {
739 return BrowserAccessibilityManager::Create( 683 return BrowserAccessibilityManager::Create(
740 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 684 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
741 } 685 }
742 686
743 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { 687 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
744 surface_factory_->EvictSurface(); 688 if (support_)
689 support_->EvictFrame();
745 local_surface_id_ = cc::LocalSurfaceId(); 690 local_surface_id_ = cc::LocalSurfaceId();
746 } 691 }
747 692
748 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { 693 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const {
749 return true; 694 return true;
750 } 695 }
751 696
752 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { 697 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const {
753 return cc::SurfaceId(frame_sink_id_, local_surface_id_); 698 return cc::SurfaceId(frame_sink_id_, local_surface_id_);
754 }; 699 };
755 700
701 void RenderWidgetHostViewChildFrame::CreateCompositorFrameSinkSupport() {
702 DCHECK(!support_);
703 support_ = base::MakeUnique<cc::CompositorFrameSinkSupport>(
704 this, GetSurfaceManager(), frame_sink_id_, false /* is_root */,
705 false /* handles_frame_sink_id_invalidation */,
706 true /* needs_sync_points */);
707 if (parent_frame_sink_id_.is_valid()) {
708 GetSurfaceManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_,
709 frame_sink_id_);
710 }
711 if (needs_begin_frame_)
712 support_->SetNeedsBeginFrame(needs_begin_frame_);
713 }
714
715 void RenderWidgetHostViewChildFrame::ResetCompositorFrameSinkSupport() {
716 if (!support_)
717 return;
718 if (parent_frame_sink_id_.is_valid()) {
719 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_,
720 frame_sink_id_);
721 }
722 support_.reset();
723 }
724
756 } // namespace content 725 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_child_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698