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

Side by Side Diff: content/renderer/input/input_handler_proxy.cc

Issue 692483002: Hook up DidReceiveInputEvent to the blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resonding to Sami's feedback Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/input_handler_proxy.h" 5 #include "content/renderer/input/input_handler_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 if (!fling_curve_) 601 if (!fling_curve_)
602 return; 602 return;
603 603
604 double monotonic_time_sec = InSecondsF(time); 604 double monotonic_time_sec = InSecondsF(time);
605 605
606 if (deferred_fling_cancel_time_seconds_ && 606 if (deferred_fling_cancel_time_seconds_ &&
607 monotonic_time_sec > deferred_fling_cancel_time_seconds_) { 607 monotonic_time_sec > deferred_fling_cancel_time_seconds_) {
608 CancelCurrentFling(); 608 CancelCurrentFling();
609 return; 609 return;
610 } 610 }
611 611
jdduke (slow) 2014/11/04 01:21:02 Would it kill us to put just a single |DidAnimate|
Sami 2014/11/04 01:29:23 Good idea, it doesn't really matter if we send one
alex clarke (OOO till 29th) 2014/11/04 01:49:05 Done.
alex clarke (OOO till 29th) 2014/11/04 01:49:05 Acknowledged.
612 if (!has_fling_animation_started_) { 612 if (!has_fling_animation_started_) {
613 has_fling_animation_started_ = true; 613 has_fling_animation_started_ = true;
614 // Guard against invalid, future or sufficiently stale start times, as there 614 // Guard against invalid, future or sufficiently stale start times, as there
615 // are no guarantees fling event and animation timestamps are compatible. 615 // are no guarantees fling event and animation timestamps are compatible.
616 if (!fling_parameters_.startTime || 616 if (!fling_parameters_.startTime ||
617 monotonic_time_sec <= fling_parameters_.startTime || 617 monotonic_time_sec <= fling_parameters_.startTime ||
618 monotonic_time_sec >= fling_parameters_.startTime + 618 monotonic_time_sec >= fling_parameters_.startTime +
619 kMaxSecondsFromFlingTimestampToFirstAnimate) { 619 kMaxSecondsFromFlingTimestampToFirstAnimate) {
620 fling_parameters_.startTime = monotonic_time_sec; 620 fling_parameters_.startTime = monotonic_time_sec;
621 input_handler_->SetNeedsAnimate(); 621 input_handler_->SetNeedsAnimate();
622 client_->DidReceiveInputEvent(); 622 client_->DidAnimate();
623 return; 623 return;
624 } 624 }
625 } 625 }
626 626
627 bool fling_is_active = 627 bool fling_is_active =
628 fling_curve_->apply(monotonic_time_sec - fling_parameters_.startTime, 628 fling_curve_->apply(monotonic_time_sec - fling_parameters_.startTime,
629 this); 629 this);
630 630
631 if (disallow_vertical_fling_scroll_ && disallow_horizontal_fling_scroll_) 631 if (disallow_vertical_fling_scroll_ && disallow_horizontal_fling_scroll_)
632 fling_is_active = false; 632 fling_is_active = false;
633 633
634 if (fling_is_active) { 634 if (fling_is_active) {
635 input_handler_->SetNeedsAnimate(); 635 input_handler_->SetNeedsAnimate();
636 client_->DidReceiveInputEvent(); 636 client_->DidAnimate();
637 } else { 637 } else {
638 TRACE_EVENT_INSTANT0("input", 638 TRACE_EVENT_INSTANT0("input",
639 "InputHandlerProxy::animate::flingOver", 639 "InputHandlerProxy::animate::flingOver",
640 TRACE_EVENT_SCOPE_THREAD); 640 TRACE_EVENT_SCOPE_THREAD);
641 CancelCurrentFling(); 641 CancelCurrentFling();
642 } 642 }
643 } 643 }
644 644
645 void InputHandlerProxy::MainThreadHasStoppedFlinging() { 645 void InputHandlerProxy::MainThreadHasStoppedFlinging() {
646 fling_may_be_active_on_main_thread_ = false; 646 fling_may_be_active_on_main_thread_ = false;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 // trigger a scroll, e.g., with a trivial time delta between fling updates. 813 // trigger a scroll, e.g., with a trivial time delta between fling updates.
814 // Return true in this case to prevent early fling termination. 814 // Return true in this case to prevent early fling termination.
815 if (std::abs(clipped_increment.width) < kScrollEpsilon && 815 if (std::abs(clipped_increment.width) < kScrollEpsilon &&
816 std::abs(clipped_increment.height) < kScrollEpsilon) 816 std::abs(clipped_increment.height) < kScrollEpsilon)
817 return true; 817 return true;
818 818
819 return did_scroll; 819 return did_scroll;
820 } 820 }
821 821
822 } // namespace content 822 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698