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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/smooth_scroll_calculator.h"
6
7 namespace content {
8
9 SmoothScrollCalculator::SmoothScrollCalculator() {
10 }
11
12 SmoothScrollCalculator::~SmoothScrollCalculator() {
13 }
14
15 double SmoothScrollCalculator::GetScrollDelta(
16 base::TimeTicks now, base::TimeDelta desired_interval) {
17 double position_delta = 10;
18 if (!last_tick_time_.is_null()) {
19 double velocity = 10 / desired_interval.InMillisecondsF();
20 double time_delta = (now - last_tick_time_).InMillisecondsF();
21 position_delta = velocity * time_delta;
22 }
23
24 last_tick_time_ = now;
25 return position_delta;
26 }
27
28 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698