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

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: c 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
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 NOTIMPLEMENTED(); 633 NOTIMPLEMENTED();
635 return static_cast<gfx::NativeViewAccessible>(NULL); 634 return static_cast<gfx::NativeViewAccessible>(NULL);
636 } 635 }
637 636
638 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { 637 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() {
639 return this; 638 return this;
640 } 639 }
641 640
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 if (delegated_frame_host_) {
644 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
645 needs_flush_input_);
646 }
645 } 647 }
646 648
647 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() { 649 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() {
648 needs_flush_input_ = true; 650 needs_flush_input_ = true;
649 UpdateNeedsBeginFramesInternal(); 651 delegated_frame_host_->SetNeedsBeginFrames(true);
650 }
651
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 } 652 }
666 653
667 void RenderWidgetHostViewAura::OnBeginFrame( 654 void RenderWidgetHostViewAura::OnBeginFrame(
668 const cc::BeginFrameArgs& args) { 655 const cc::BeginFrameArgs& args) {
669 needs_flush_input_ = false; 656 needs_flush_input_ = false;
670 host_->FlushInput(); 657 host_->FlushInput();
671 UpdateNeedsBeginFramesInternal(); 658 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
Eric Seckler 2017/03/27 13:05:03 I'd prefer to keep UpdateNeedsBeginFramesInternal,
Saman Sami 2017/03/27 17:10:23 Done.
659 needs_flush_input_);
672 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); 660 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 } 661 }
684 662
685 RenderFrameHostImpl* RenderWidgetHostViewAura::GetFocusedFrame() { 663 RenderFrameHostImpl* RenderWidgetHostViewAura::GetFocusedFrame() {
686 RenderViewHost* rvh = RenderViewHost::From(host_); 664 RenderViewHost* rvh = RenderViewHost::From(host_);
687 if (!rvh) 665 if (!rvh)
688 return nullptr; 666 return nullptr;
689 FrameTreeNode* focused_frame = 667 FrameTreeNode* focused_frame =
690 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); 668 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame();
691 if (!focused_frame) 669 if (!focused_frame)
692 return nullptr; 670 return nullptr;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 903
926 start_edge_top.Scale(viewportToDIPScale); 904 start_edge_top.Scale(viewportToDIPScale);
927 start_edge_bottom.Scale(viewportToDIPScale); 905 start_edge_bottom.Scale(viewportToDIPScale);
928 end_edge_top.Scale(viewportToDIPScale); 906 end_edge_top.Scale(viewportToDIPScale);
929 end_edge_bottom.Scale(viewportToDIPScale); 907 end_edge_bottom.Scale(viewportToDIPScale);
930 908
931 selection.start.SetEdge(start_edge_top, start_edge_bottom); 909 selection.start.SetEdge(start_edge_top, start_edge_bottom);
932 selection.end.SetEdge(end_edge_top, end_edge_bottom); 910 selection.end.SetEdge(end_edge_top, end_edge_bottom);
933 } 911 }
934 912
935 cc::BeginFrameAck ack(frame.metadata.begin_frame_ack);
936
937 if (delegated_frame_host_) { 913 if (delegated_frame_host_) {
938 delegated_frame_host_->SwapDelegatedFrame( 914 delegated_frame_host_->SwapDelegatedFrame(
939 compositor_frame_sink_id, local_surface_id, std::move(frame)); 915 compositor_frame_sink_id, local_surface_id, std::move(frame));
940 } 916 }
941 selection_controller_->OnSelectionBoundsChanged(selection.start, 917 selection_controller_->OnSelectionBoundsChanged(selection.start,
942 selection.end); 918 selection.end);
943
944 if (begin_frame_source_)
945 begin_frame_source_->DidFinishFrame(this, ack);
946 } 919 }
947 920
948 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap( 921 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap(
949 const cc::BeginFrameAck& ack) { 922 const cc::BeginFrameAck& ack) {
950 if (begin_frame_source_) 923 delegated_frame_host_->BeginFrameDidNotSwap(ack);
951 begin_frame_source_->DidFinishFrame(this, ack);
952 } 924 }
953 925
954 void RenderWidgetHostViewAura::ClearCompositorFrame() { 926 void RenderWidgetHostViewAura::ClearCompositorFrame() {
955 if (delegated_frame_host_) 927 if (delegated_frame_host_)
956 delegated_frame_host_->ClearDelegatedFrame(); 928 delegated_frame_host_->ClearDelegatedFrame();
957 } 929 }
958 930
959 void RenderWidgetHostViewAura::DidStopFlinging() { 931 void RenderWidgetHostViewAura::DidStopFlinging() {
960 selection_controller_client_->OnScrollCompleted(); 932 selection_controller_client_->OnScrollCompleted();
961 } 933 }
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 cc::FrameSinkId frame_sink_id = 1909 cc::FrameSinkId frame_sink_id =
1938 host_->AllocateFrameSinkId(is_guest_view_hack_); 1910 host_->AllocateFrameSinkId(is_guest_view_hack_);
1939 1911
1940 // Tests may set |delegated_frame_host_client_|. 1912 // Tests may set |delegated_frame_host_client_|.
1941 if (!delegated_frame_host_client_) { 1913 if (!delegated_frame_host_client_) {
1942 delegated_frame_host_client_ = 1914 delegated_frame_host_client_ =
1943 base::MakeUnique<DelegatedFrameHostClientAura>(this); 1915 base::MakeUnique<DelegatedFrameHostClientAura>(this);
1944 } 1916 }
1945 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>( 1917 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>(
1946 frame_sink_id, delegated_frame_host_client_.get()); 1918 frame_sink_id, delegated_frame_host_client_.get());
1919 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
1920 needs_flush_input_);
1947 1921
1948 // Let the page-level input event router know about our surface ID 1922 // Let the page-level input event router know about our surface ID
1949 // namespace for surface-based hit testing. 1923 // namespace for surface-based hit testing.
1950 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { 1924 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
1951 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( 1925 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner(
1952 GetFrameSinkId(), this); 1926 GetFrameSinkId(), this);
1953 } 1927 }
1954 } 1928 }
1955 1929
1956 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 1930 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 2341
2368 void RenderWidgetHostViewAura::SetPopupChild( 2342 void RenderWidgetHostViewAura::SetPopupChild(
2369 RenderWidgetHostViewAura* popup_child_host_view) { 2343 RenderWidgetHostViewAura* popup_child_host_view) {
2370 popup_child_host_view_ = popup_child_host_view; 2344 popup_child_host_view_ = popup_child_host_view;
2371 event_handler_->SetPopupChild( 2345 event_handler_->SetPopupChild(
2372 popup_child_host_view, 2346 popup_child_host_view,
2373 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); 2347 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr);
2374 } 2348 }
2375 2349
2376 } // namespace content 2350 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698