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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2776973002: DelegatedFrameHost should not create an ExternalBeginFrameSource (Closed)
Patch Set: Added comment Created 3 years, 8 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/renderer_host/render_widget_host_view_aura.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, 376 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,
377 bool is_guest_view_hack) 377 bool is_guest_view_hack)
378 : host_(RenderWidgetHostImpl::From(host)), 378 : host_(RenderWidgetHostImpl::From(host)),
379 window_(nullptr), 379 window_(nullptr),
380 in_shutdown_(false), 380 in_shutdown_(false),
381 in_bounds_changed_(false), 381 in_bounds_changed_(false),
382 popup_parent_host_view_(nullptr), 382 popup_parent_host_view_(nullptr),
383 popup_child_host_view_(nullptr), 383 popup_child_host_view_(nullptr),
384 is_loading_(false), 384 is_loading_(false),
385 has_composition_text_(false), 385 has_composition_text_(false),
386 begin_frame_source_(nullptr),
387 needs_begin_frames_(false), 386 needs_begin_frames_(false),
388 needs_flush_input_(false), 387 needs_flush_input_(false),
389 added_frame_observer_(false), 388 added_frame_observer_(false),
390 cursor_visibility_state_in_renderer_(UNKNOWN), 389 cursor_visibility_state_in_renderer_(UNKNOWN),
391 #if defined(OS_WIN) 390 #if defined(OS_WIN)
392 legacy_render_widget_host_HWND_(nullptr), 391 legacy_render_widget_host_HWND_(nullptr),
393 legacy_window_destroyed_(false), 392 legacy_window_destroyed_(false),
394 virtual_keyboard_requested_(false), 393 virtual_keyboard_requested_(false),
395 #endif 394 #endif
396 has_snapped_to_boundary_(false), 395 has_snapped_to_boundary_(false),
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) { 641 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) {
643 needs_begin_frames_ = needs_begin_frames; 642 needs_begin_frames_ = needs_begin_frames;
644 UpdateNeedsBeginFramesInternal(); 643 UpdateNeedsBeginFramesInternal();
645 } 644 }
646 645
647 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() { 646 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() {
648 needs_flush_input_ = true; 647 needs_flush_input_ = true;
649 UpdateNeedsBeginFramesInternal(); 648 UpdateNeedsBeginFramesInternal();
650 } 649 }
651 650
652 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() {
653 if (!begin_frame_source_)
654 return;
655
656 bool needs_frame = needs_begin_frames_ || needs_flush_input_;
657 if (needs_frame == added_frame_observer_)
658 return;
659
660 added_frame_observer_ = needs_frame;
661 if (needs_frame)
662 begin_frame_source_->AddObserver(this);
663 else
664 begin_frame_source_->RemoveObserver(this);
665 }
666
667 void RenderWidgetHostViewAura::OnBeginFrame( 651 void RenderWidgetHostViewAura::OnBeginFrame(
668 const cc::BeginFrameArgs& args) { 652 const cc::BeginFrameArgs& args) {
669 needs_flush_input_ = false; 653 needs_flush_input_ = false;
670 host_->FlushInput(); 654 host_->FlushInput();
671 UpdateNeedsBeginFramesInternal(); 655 UpdateNeedsBeginFramesInternal();
672 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); 656 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args));
673 last_begin_frame_args_ = args;
674 }
675
676 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs()
677 const {
678 return last_begin_frame_args_;
679 }
680
681 void RenderWidgetHostViewAura::OnBeginFrameSourcePausedChanged(bool paused) {
682 // Only used on Android WebView.
683 } 657 }
684 658
685 RenderFrameHostImpl* RenderWidgetHostViewAura::GetFocusedFrame() { 659 RenderFrameHostImpl* RenderWidgetHostViewAura::GetFocusedFrame() {
686 RenderViewHost* rvh = RenderViewHost::From(host_); 660 RenderViewHost* rvh = RenderViewHost::From(host_);
687 if (!rvh) 661 if (!rvh)
688 return nullptr; 662 return nullptr;
689 FrameTreeNode* focused_frame = 663 FrameTreeNode* focused_frame =
690 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); 664 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame();
691 if (!focused_frame) 665 if (!focused_frame)
692 return nullptr; 666 return nullptr;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 899
926 start_edge_top.Scale(viewportToDIPScale); 900 start_edge_top.Scale(viewportToDIPScale);
927 start_edge_bottom.Scale(viewportToDIPScale); 901 start_edge_bottom.Scale(viewportToDIPScale);
928 end_edge_top.Scale(viewportToDIPScale); 902 end_edge_top.Scale(viewportToDIPScale);
929 end_edge_bottom.Scale(viewportToDIPScale); 903 end_edge_bottom.Scale(viewportToDIPScale);
930 904
931 selection.start.SetEdge(start_edge_top, start_edge_bottom); 905 selection.start.SetEdge(start_edge_top, start_edge_bottom);
932 selection.end.SetEdge(end_edge_top, end_edge_bottom); 906 selection.end.SetEdge(end_edge_top, end_edge_bottom);
933 } 907 }
934 908
935 cc::BeginFrameAck ack(frame.metadata.begin_frame_ack);
936
937 if (delegated_frame_host_) { 909 if (delegated_frame_host_) {
938 delegated_frame_host_->SwapDelegatedFrame( 910 delegated_frame_host_->SwapDelegatedFrame(
939 compositor_frame_sink_id, local_surface_id, std::move(frame)); 911 compositor_frame_sink_id, local_surface_id, std::move(frame));
940 } 912 }
941 selection_controller_->OnSelectionBoundsChanged(selection.start, 913 selection_controller_->OnSelectionBoundsChanged(selection.start,
942 selection.end); 914 selection.end);
943
944 if (begin_frame_source_)
945 begin_frame_source_->DidFinishFrame(this, ack);
946 } 915 }
947 916
948 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap( 917 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap(
949 const cc::BeginFrameAck& ack) { 918 const cc::BeginFrameAck& ack) {
950 if (begin_frame_source_) 919 delegated_frame_host_->DidFinishFrame(ack);
Eric Seckler 2017/03/27 18:16:09 Nit: I'd keep DelegatedFrameHost::BeginFrameDidNot
951 begin_frame_source_->DidFinishFrame(this, ack);
952 } 920 }
953 921
954 void RenderWidgetHostViewAura::ClearCompositorFrame() { 922 void RenderWidgetHostViewAura::ClearCompositorFrame() {
955 if (delegated_frame_host_) 923 if (delegated_frame_host_)
956 delegated_frame_host_->ClearDelegatedFrame(); 924 delegated_frame_host_->ClearDelegatedFrame();
957 } 925 }
958 926
959 void RenderWidgetHostViewAura::DidStopFlinging() { 927 void RenderWidgetHostViewAura::DidStopFlinging() {
960 selection_controller_client_->OnScrollCompleted(); 928 selection_controller_client_->OnScrollCompleted();
961 } 929 }
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 cc::FrameSinkId frame_sink_id = 1905 cc::FrameSinkId frame_sink_id =
1938 host_->AllocateFrameSinkId(is_guest_view_hack_); 1906 host_->AllocateFrameSinkId(is_guest_view_hack_);
1939 1907
1940 // Tests may set |delegated_frame_host_client_|. 1908 // Tests may set |delegated_frame_host_client_|.
1941 if (!delegated_frame_host_client_) { 1909 if (!delegated_frame_host_client_) {
1942 delegated_frame_host_client_ = 1910 delegated_frame_host_client_ =
1943 base::MakeUnique<DelegatedFrameHostClientAura>(this); 1911 base::MakeUnique<DelegatedFrameHostClientAura>(this);
1944 } 1912 }
1945 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>( 1913 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>(
1946 frame_sink_id, delegated_frame_host_client_.get()); 1914 frame_sink_id, delegated_frame_host_client_.get());
1915 UpdateNeedsBeginFramesInternal();
1947 1916
1948 // Let the page-level input event router know about our surface ID 1917 // Let the page-level input event router know about our surface ID
1949 // namespace for surface-based hit testing. 1918 // namespace for surface-based hit testing.
1950 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { 1919 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
1951 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( 1920 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner(
1952 GetFrameSinkId(), this); 1921 GetFrameSinkId(), this);
1953 } 1922 }
1954 } 1923 }
1955 1924
1956 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 1925 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 } 2335 }
2367 2336
2368 void RenderWidgetHostViewAura::SetPopupChild( 2337 void RenderWidgetHostViewAura::SetPopupChild(
2369 RenderWidgetHostViewAura* popup_child_host_view) { 2338 RenderWidgetHostViewAura* popup_child_host_view) {
2370 popup_child_host_view_ = popup_child_host_view; 2339 popup_child_host_view_ = popup_child_host_view;
2371 event_handler_->SetPopupChild( 2340 event_handler_->SetPopupChild(
2372 popup_child_host_view, 2341 popup_child_host_view,
2373 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); 2342 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr);
2374 } 2343 }
2375 2344
2345 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() {
2346 if (!delegated_frame_host_)
2347 return;
2348 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
2349 needs_flush_input_);
2350 }
2351
2376 } // namespace content 2352 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698