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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2166703003: Implement Main Thread RAF Aligned Input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_main_thread_queue
Patch Set: Rename NeedsMainFrame to SetNeedsMainFrame and move it to the render_widget Created 4 years, 3 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/renderer/render_widget.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 void RenderWidget::OnSetFocus(bool enable) { 688 void RenderWidget::OnSetFocus(bool enable) {
689 has_focus_ = enable; 689 has_focus_ = enable;
690 690
691 if (webwidget_) 691 if (webwidget_)
692 webwidget_->setFocus(enable); 692 webwidget_->setFocus(enable);
693 693
694 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, 694 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_,
695 RenderWidgetSetFocus(enable)); 695 RenderWidgetSetFocus(enable));
696 } 696 }
697 697
698 void RenderWidget::SetNeedsMainFrame() {
699 RenderWidgetCompositor* rwc = compositor();
700 if (!rwc)
701 return;
702 rwc->setNeedsBeginFrame();
703 }
704
698 /////////////////////////////////////////////////////////////////////////////// 705 ///////////////////////////////////////////////////////////////////////////////
699 // RenderWidgetCompositorDelegate 706 // RenderWidgetCompositorDelegate
700 707
701 void RenderWidget::ApplyViewportDeltas( 708 void RenderWidget::ApplyViewportDeltas(
702 const gfx::Vector2dF& inner_delta, 709 const gfx::Vector2dF& inner_delta,
703 const gfx::Vector2dF& outer_delta, 710 const gfx::Vector2dF& outer_delta,
704 const gfx::Vector2dF& elastic_overscroll_delta, 711 const gfx::Vector2dF& elastic_overscroll_delta,
705 float page_scale, 712 float page_scale,
706 float top_controls_delta) { 713 float top_controls_delta) {
707 webwidget_->applyViewportDeltas(inner_delta, outer_delta, 714 webwidget_->applyViewportDeltas(inner_delta, outer_delta,
708 elastic_overscroll_delta, page_scale, 715 elastic_overscroll_delta, page_scale,
709 top_controls_delta); 716 top_controls_delta);
710 } 717 }
711 718
712 void RenderWidget::BeginMainFrame(double frame_time_sec) { 719 void RenderWidget::BeginMainFrame(double frame_time_sec) {
720 RenderThreadImpl* render_thread = RenderThreadImpl::current();
721 // render_thread may be NULL in tests.
722 InputHandlerManager* input_handler_manager =
723 render_thread ? render_thread->input_handler_manager() : NULL;
724 if (input_handler_manager)
725 input_handler_manager->ProcessRafAlignedInputOnMainThread(routing_id_);
726
713 webwidget_->beginFrame(frame_time_sec); 727 webwidget_->beginFrame(frame_time_sec);
714 } 728 }
715 729
716 std::unique_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface( 730 std::unique_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(
717 bool fallback) { 731 bool fallback) {
718 DCHECK(webwidget_); 732 DCHECK(webwidget_);
719 // For widgets that are never visible, we don't start the compositor, so we 733 // For widgets that are never visible, we don't start the compositor, so we
720 // never get a request for a cc::OutputSurface. 734 // never get a request for a cc::OutputSurface.
721 DCHECK(!compositor_never_visible_); 735 DCHECK(!compositor_never_visible_);
722 return RenderThreadImpl::current()->CreateCompositorOutputSurface( 736 return RenderThreadImpl::current()->CreateCompositorOutputSurface(
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 void RenderWidget::requestPointerUnlock() { 2080 void RenderWidget::requestPointerUnlock() {
2067 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); 2081 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get());
2068 } 2082 }
2069 2083
2070 bool RenderWidget::isPointerLocked() { 2084 bool RenderWidget::isPointerLocked() {
2071 return mouse_lock_dispatcher_->IsMouseLockedTo( 2085 return mouse_lock_dispatcher_->IsMouseLockedTo(
2072 webwidget_mouse_lock_target_.get()); 2086 webwidget_mouse_lock_target_.get());
2073 } 2087 }
2074 2088
2075 } // namespace content 2089 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698