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

Unified Diff: content/browser/renderer_host/smooth_scroll_calculator.cc

Issue 11793003: Relands: Telemetry: hooks "chrome.gpuBenchmarking.smoothScrollBy" with java on android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/smooth_scroll_calculator.cc
diff --git a/content/browser/renderer_host/smooth_scroll_calculator.cc b/content/browser/renderer_host/smooth_scroll_calculator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2538a188354a5a0c965fef1620dc541df5f05531
--- /dev/null
+++ b/content/browser/renderer_host/smooth_scroll_calculator.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/smooth_scroll_calculator.h"
+
+namespace content {
+
+SmoothScrollCalculator::SmoothScrollCalculator() {
+}
+
+SmoothScrollCalculator::~SmoothScrollCalculator() {
+}
+
+double SmoothScrollCalculator::GetScrollDelta(
+ base::TimeTicks now, base::TimeDelta desired_interval) {
+ double position_delta = 10;
+ if (!last_tick_time_.is_null()) {
+ double velocity = 10 / desired_interval.InMillisecondsF();
+ double time_delta = (now - last_tick_time_).InMillisecondsF();
+ position_delta = velocity * time_delta;
+ }
+
+ last_tick_time_ = now;
+ return position_delta;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698