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

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: Added a test 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
Sami 2014/11/03 23:54:07 It feels a little wrong to lie to the client about
alex clarke (OOO till 29th) 2014/11/04 01:14:35 Done.
622 return; 623 return;
623 } 624 }
624 } 625 }
625 626
626 bool fling_is_active = 627 bool fling_is_active =
627 fling_curve_->apply(monotonic_time_sec - fling_parameters_.startTime, 628 fling_curve_->apply(monotonic_time_sec - fling_parameters_.startTime,
628 this); 629 this);
629 630
630 if (disallow_vertical_fling_scroll_ && disallow_horizontal_fling_scroll_) 631 if (disallow_vertical_fling_scroll_ && disallow_horizontal_fling_scroll_)
631 fling_is_active = false; 632 fling_is_active = false;
632 633
633 if (fling_is_active) { 634 if (fling_is_active) {
634 input_handler_->SetNeedsAnimate(); 635 input_handler_->SetNeedsAnimate();
636 client_->DidReceiveInputEvent();
635 } else { 637 } else {
636 TRACE_EVENT_INSTANT0("input", 638 TRACE_EVENT_INSTANT0("input",
637 "InputHandlerProxy::animate::flingOver", 639 "InputHandlerProxy::animate::flingOver",
638 TRACE_EVENT_SCOPE_THREAD); 640 TRACE_EVENT_SCOPE_THREAD);
639 CancelCurrentFling(); 641 CancelCurrentFling();
640 } 642 }
641 } 643 }
642 644
643 void InputHandlerProxy::MainThreadHasStoppedFlinging() { 645 void InputHandlerProxy::MainThreadHasStoppedFlinging() {
644 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
811 // 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.
812 // Return true in this case to prevent early fling termination. 814 // Return true in this case to prevent early fling termination.
813 if (std::abs(clipped_increment.width) < kScrollEpsilon && 815 if (std::abs(clipped_increment.width) < kScrollEpsilon &&
814 std::abs(clipped_increment.height) < kScrollEpsilon) 816 std::abs(clipped_increment.height) < kScrollEpsilon)
815 return true; 817 return true;
816 818
817 return did_scroll; 819 return did_scroll;
818 } 820 }
819 821
820 } // namespace content 822 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698