Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / renderer_host / smooth_scroll_calculator.cc
blob2538a188354a5a0c965fef1620dc541df5f05531
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.
5 #include "content/browser/renderer_host/smooth_scroll_calculator.h"
7 namespace content {
9 SmoothScrollCalculator::SmoothScrollCalculator() {
12 SmoothScrollCalculator::~SmoothScrollCalculator() {
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;
24 last_tick_time_ = now;
25 return position_delta;
28 } // namespace content