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

Side by Side Diff: ui/events/gestures/blink/web_gesture_curve_impl.cc

Issue 1539583003: Convert Pass()→std::move() in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/events/gestures/blink/web_gesture_curve_impl.h" 5 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
6 6
7 #include <utility>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
9 #include "third_party/WebKit/public/platform/WebFloatSize.h" 11 #include "third_party/WebKit/public/platform/WebFloatSize.h"
10 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" 12 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
11 #include "ui/events/gestures/fling_curve.h" 13 #include "ui/events/gestures/fling_curve.h"
12 #include "ui/gfx/geometry/safe_integer_conversions.h" 14 #include "ui/gfx/geometry/safe_integer_conversions.h"
13 #include "ui/gfx/geometry/vector2d.h" 15 #include "ui/gfx/geometry/vector2d.h"
14 16
15 #if defined(OS_ANDROID) 17 #if defined(OS_ANDROID)
16 #include "ui/events/android/scroller.h" 18 #include "ui/events/android/scroller.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 bool on_main_thread) { 53 bool on_main_thread) {
52 return scoped_ptr<WebGestureCurve>(new WebGestureCurveImpl( 54 return scoped_ptr<WebGestureCurve>(new WebGestureCurveImpl(
53 CreateDefaultPlatformCurve(initial_velocity), initial_offset, 55 CreateDefaultPlatformCurve(initial_velocity), initial_offset,
54 on_main_thread ? ThreadType::MAIN : ThreadType::IMPL)); 56 on_main_thread ? ThreadType::MAIN : ThreadType::IMPL));
55 } 57 }
56 58
57 // static 59 // static
58 scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFromUICurveForTesting( 60 scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFromUICurveForTesting(
59 scoped_ptr<GestureCurve> curve, 61 scoped_ptr<GestureCurve> curve,
60 const gfx::Vector2dF& initial_offset) { 62 const gfx::Vector2dF& initial_offset) {
61 return scoped_ptr<WebGestureCurve>( 63 return scoped_ptr<WebGestureCurve>(new WebGestureCurveImpl(
62 new WebGestureCurveImpl(curve.Pass(), initial_offset, ThreadType::TEST)); 64 std::move(curve), initial_offset, ThreadType::TEST));
63 } 65 }
64 66
65 WebGestureCurveImpl::WebGestureCurveImpl(scoped_ptr<GestureCurve> curve, 67 WebGestureCurveImpl::WebGestureCurveImpl(scoped_ptr<GestureCurve> curve,
66 const gfx::Vector2dF& initial_offset, 68 const gfx::Vector2dF& initial_offset,
67 ThreadType animating_thread_type) 69 ThreadType animating_thread_type)
68 : curve_(curve.Pass()), 70 : curve_(std::move(curve)),
69 last_offset_(initial_offset), 71 last_offset_(initial_offset),
70 animating_thread_type_(animating_thread_type), 72 animating_thread_type_(animating_thread_type),
71 ticks_since_first_animate_(0), 73 ticks_since_first_animate_(0),
72 first_animate_time_(0), 74 first_animate_time_(0),
73 last_animate_time_(0) { 75 last_animate_time_(0) {}
74 }
75 76
76 WebGestureCurveImpl::~WebGestureCurveImpl() { 77 WebGestureCurveImpl::~WebGestureCurveImpl() {
77 if (ticks_since_first_animate_ <= 1) 78 if (ticks_since_first_animate_ <= 1)
78 return; 79 return;
79 80
80 if (last_animate_time_ <= first_animate_time_) 81 if (last_animate_time_ <= first_animate_time_)
81 return; 82 return;
82 83
83 switch (animating_thread_type_) { 84 switch (animating_thread_type_) {
84 case ThreadType::MAIN: 85 case ThreadType::MAIN:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return still_active; 133 return still_active;
133 134
134 // scrollBy() could delete this curve if the animation is over, so don't touch 135 // scrollBy() could delete this curve if the animation is over, so don't touch
135 // any member variables after making that call. 136 // any member variables after making that call.
136 bool did_scroll = target->scrollBy(blink::WebFloatSize(delta), 137 bool did_scroll = target->scrollBy(blink::WebFloatSize(delta),
137 blink::WebFloatSize(velocity)); 138 blink::WebFloatSize(velocity));
138 return did_scroll && still_active; 139 return did_scroll && still_active;
139 } 140 }
140 141
141 } // namespace ui 142 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/motion_event_generic_unittest.cc ('k') | ui/events/gestures/gesture_provider_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698