summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajay.berwal@samsung.com <ajay.berwal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 10:39:12 +0000
committerajay.berwal@samsung.com <ajay.berwal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 10:39:12 +0000
commit3244c913f7fc31c43107ffd895c786f26b892c07 (patch)
tree15f33a1820994df0998f7be8b89740f82dbde1ed
parent8aaf0f58eb8b532a4190a55c753f4796d7515933 (diff)
downloadchromium_src-3244c913f7fc31c43107ffd895c786f26b892c07.zip
chromium_src-3244c913f7fc31c43107ffd895c786f26b892c07.tar.gz
chromium_src-3244c913f7fc31c43107ffd895c786f26b892c07.tar.bz2
Pass gfx structs by const ref (gfx::Vector2dF)
Avoid unneccessary copy of structures gfx::Vector2dF by passing them by const ref rather than value. Any struct of size > 4 bytes should be passed by const ref. Passing by ref for these structs is faster than passing by value, especially when invoking function has multiple parameters. Pass gfx structs by const ref (gfx::Vector2dF) BUG=159273 Review URL: https://codereview.chromium.org/130443005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246563 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--cc/animation/layer_animation_controller.cc2
-rw-r--r--cc/animation/layer_animation_controller.h2
-rw-r--r--cc/animation/layer_animation_value_observer.h2
-rw-r--r--cc/animation/scroll_offset_animation_curve.cc7
-rw-r--r--cc/animation/scroll_offset_animation_curve.h6
-rw-r--r--cc/base/math_util.cc8
-rw-r--r--cc/base/math_util.h8
-rw-r--r--cc/input/input_handler.h4
-rw-r--r--cc/input/layer_scroll_offset_delegate.h4
-rw-r--r--cc/input/page_scale_animation.cc16
-rw-r--r--cc/input/page_scale_animation.h8
-rw-r--r--cc/input/top_controls_manager.cc2
-rw-r--r--cc/input/top_controls_manager.h2
-rw-r--r--cc/layers/layer.cc2
-rw-r--r--cc/layers/layer.h3
-rw-r--r--cc/layers/layer_impl.cc8
-rw-r--r--cc/layers/layer_impl.h11
-rw-r--r--cc/layers/layer_impl_unittest.cc12
-rw-r--r--cc/test/animation_test_common.cc2
-rw-r--r--cc/test/animation_test_common.h5
-rw-r--r--cc/trees/layer_sorter.cc3
-rw-r--r--cc/trees/layer_tree_host_common.cc8
-rw-r--r--cc/trees/layer_tree_host_impl.cc9
-rw-r--r--cc/trees/layer_tree_host_impl.h7
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc7
-rw-r--r--content/browser/android/in_process/synchronous_compositor_impl.cc5
-rw-r--r--content/browser/android/in_process/synchronous_compositor_impl.h5
-rw-r--r--content/renderer/input/input_handler_proxy_unittest.cc6
29 files changed, 90 insertions, 75 deletions
diff --git a/AUTHORS b/AUTHORS
index 207d990..16e5d4a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -14,6 +14,7 @@ Aaron Randolph <aaron.randolph@gmail.com>
Adam Treat <adam.treat@samsung.com>
Adenilson Cavalcanti <a.cavalcanti@partner.samsung.com>
Aditya Bhargava <heuristicist@gmail.com>
+Ajay Berwal <ajay.berwal@samsung.com>
Alex Gartrell <agartrell@cmu.edu>
Alex Scheele <alexscheele@gmail.com>
Alexander Sulfrian <alexander@sulfrian.net>
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index e1ab646..623949d 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -768,7 +768,7 @@ void LayerAnimationController::NotifyObserversFilterAnimated(
}
void LayerAnimationController::NotifyObserversScrollOffsetAnimated(
- gfx::Vector2dF scroll_offset) {
+ const gfx::Vector2dF& scroll_offset) {
FOR_EACH_OBSERVER(LayerAnimationValueObserver,
value_observers_,
OnScrollOffsetAnimated(scroll_offset));
diff --git a/cc/animation/layer_animation_controller.h b/cc/animation/layer_animation_controller.h
index 564a593..8596b50 100644
--- a/cc/animation/layer_animation_controller.h
+++ b/cc/animation/layer_animation_controller.h
@@ -146,7 +146,7 @@ class CC_EXPORT LayerAnimationController
void NotifyObserversOpacityAnimated(float opacity);
void NotifyObserversTransformAnimated(const gfx::Transform& transform);
void NotifyObserversFilterAnimated(const FilterOperations& filter);
- void NotifyObserversScrollOffsetAnimated(gfx::Vector2dF scroll_offset);
+ void NotifyObserversScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset);
void NotifyObserversAnimationWaitingForDeletion();
diff --git a/cc/animation/layer_animation_value_observer.h b/cc/animation/layer_animation_value_observer.h
index d21ade8..e091806 100644
--- a/cc/animation/layer_animation_value_observer.h
+++ b/cc/animation/layer_animation_value_observer.h
@@ -16,7 +16,7 @@ class CC_EXPORT LayerAnimationValueObserver {
virtual void OnFilterAnimated(const FilterOperations& filters) = 0;
virtual void OnOpacityAnimated(float opacity) = 0;
virtual void OnTransformAnimated(const gfx::Transform& transform) = 0;
- virtual void OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) = 0;
+ virtual void OnScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset) = 0;
virtual void OnAnimationWaitingForDeletion() = 0;
virtual bool IsActive() const = 0;
};
diff --git a/cc/animation/scroll_offset_animation_curve.cc b/cc/animation/scroll_offset_animation_curve.cc
index 362aa1e..ecba43f 100644
--- a/cc/animation/scroll_offset_animation_curve.cc
+++ b/cc/animation/scroll_offset_animation_curve.cc
@@ -16,14 +16,14 @@ const double kDurationDivisor = 60.0;
namespace cc {
scoped_ptr<ScrollOffsetAnimationCurve> ScrollOffsetAnimationCurve::Create(
- gfx::Vector2dF target_value,
+ const gfx::Vector2dF& target_value,
scoped_ptr<TimingFunction> timing_function) {
return make_scoped_ptr(
new ScrollOffsetAnimationCurve(target_value, timing_function.Pass()));
}
ScrollOffsetAnimationCurve::ScrollOffsetAnimationCurve(
- gfx::Vector2dF target_value,
+ const gfx::Vector2dF& target_value,
scoped_ptr<TimingFunction> timing_function)
: target_value_(target_value),
duration_(0.0),
@@ -31,7 +31,8 @@ ScrollOffsetAnimationCurve::ScrollOffsetAnimationCurve(
ScrollOffsetAnimationCurve::~ScrollOffsetAnimationCurve() {}
-void ScrollOffsetAnimationCurve::SetInitialValue(gfx::Vector2dF initial_value) {
+void ScrollOffsetAnimationCurve::SetInitialValue(
+ const gfx::Vector2dF& initial_value) {
initial_value_ = initial_value;
// The duration of a scroll animation depends on the size of the scroll.
diff --git a/cc/animation/scroll_offset_animation_curve.h b/cc/animation/scroll_offset_animation_curve.h
index ba46615..0d45cf2 100644
--- a/cc/animation/scroll_offset_animation_curve.h
+++ b/cc/animation/scroll_offset_animation_curve.h
@@ -16,12 +16,12 @@ class TimingFunction;
class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve {
public:
static scoped_ptr<ScrollOffsetAnimationCurve> Create(
- gfx::Vector2dF target_value,
+ const gfx::Vector2dF& target_value,
scoped_ptr<TimingFunction> timing_function);
virtual ~ScrollOffsetAnimationCurve();
- void SetInitialValue(gfx::Vector2dF initial_value);
+ void SetInitialValue(const gfx::Vector2dF& initial_value);
gfx::Vector2dF GetValue(double t) const;
// AnimationCurve implementation
@@ -30,7 +30,7 @@ class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve {
virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
private:
- ScrollOffsetAnimationCurve(gfx::Vector2dF target_value,
+ ScrollOffsetAnimationCurve(const gfx::Vector2dF& target_value,
scoped_ptr <TimingFunction> timing_function);
gfx::Vector2dF initial_value_;
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 099a993..8abfa90f0 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -492,16 +492,16 @@ gfx::Vector2dF MathUtil::ComputeTransform2dScaleComponents(
return gfx::Vector2dF(x_scale, y_scale);
}
-float MathUtil::SmallestAngleBetweenVectors(gfx::Vector2dF v1,
- gfx::Vector2dF v2) {
+float MathUtil::SmallestAngleBetweenVectors(const gfx::Vector2dF& v1,
+ const gfx::Vector2dF& v2) {
double dot_product = gfx::DotProduct(v1, v2) / v1.Length() / v2.Length();
// Clamp to compensate for rounding errors.
dot_product = std::max(-1.0, std::min(1.0, dot_product));
return static_cast<float>(Rad2Deg(std::acos(dot_product)));
}
-gfx::Vector2dF MathUtil::ProjectVector(gfx::Vector2dF source,
- gfx::Vector2dF destination) {
+gfx::Vector2dF MathUtil::ProjectVector(const gfx::Vector2dF& source,
+ const gfx::Vector2dF& destination) {
float projected_length =
gfx::DotProduct(source, destination) / destination.LengthSquared();
return gfx::Vector2dF(projected_length * destination.x(),
diff --git a/cc/base/math_util.h b/cc/base/math_util.h
index c598fcf..6cad1ad 100644
--- a/cc/base/math_util.h
+++ b/cc/base/math_util.h
@@ -156,13 +156,13 @@ class CC_EXPORT MathUtil {
// Returns the smallest angle between the given two vectors in degrees.
// Neither vector is assumed to be normalized.
- static float SmallestAngleBetweenVectors(gfx::Vector2dF v1,
- gfx::Vector2dF v2);
+ static float SmallestAngleBetweenVectors(const gfx::Vector2dF& v1,
+ const gfx::Vector2dF& v2);
// Projects the |source| vector onto |destination|. Neither vector is assumed
// to be normalized.
- static gfx::Vector2dF ProjectVector(gfx::Vector2dF source,
- gfx::Vector2dF destination);
+ static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source,
+ const gfx::Vector2dF& destination);
// Conversion to value.
static scoped_ptr<base::Value> AsValue(gfx::Size s);
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index fde89d2..987f7a6 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -85,7 +85,7 @@ class CC_EXPORT InputHandler {
// to the client.
// Should only be called if ScrollBegin() returned ScrollStarted.
virtual bool ScrollBy(gfx::Point viewport_point,
- gfx::Vector2dF scroll_delta) = 0;
+ const gfx::Vector2dF& scroll_delta) = 0;
virtual bool ScrollVerticallyByPage(
gfx::Point viewport_point,
@@ -95,7 +95,7 @@ class CC_EXPORT InputHandler {
// ScrollIgnored if not.
virtual ScrollStatus FlingScrollBegin() = 0;
- virtual void NotifyCurrentFlingVelocity(gfx::Vector2dF velocity) = 0;
+ virtual void NotifyCurrentFlingVelocity(const gfx::Vector2dF& velocity) = 0;
virtual void MouseMoveAt(gfx::Point mouse_position) = 0;
diff --git a/cc/input/layer_scroll_offset_delegate.h b/cc/input/layer_scroll_offset_delegate.h
index 1ee9736..034daab 100644
--- a/cc/input/layer_scroll_offset_delegate.h
+++ b/cc/input/layer_scroll_offset_delegate.h
@@ -19,11 +19,11 @@ class LayerScrollOffsetDelegate {
public:
// This is called by the compositor to notify the delegate what is the upper
// total scroll offset bound.
- virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) = 0;
+ virtual void SetMaxScrollOffset(const gfx::Vector2dF& max_scroll_offset) = 0;
// This is called by the compositor when the scroll offset of the layer would
// have otherwise changed.
- virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) = 0;
+ virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) = 0;
// This is called by the compositor to query the current scroll offset of the
// layer.
diff --git a/cc/input/page_scale_animation.cc b/cc/input/page_scale_animation.cc
index 88b64d59..7df0244 100644
--- a/cc/input/page_scale_animation.cc
+++ b/cc/input/page_scale_animation.cc
@@ -16,22 +16,22 @@ namespace {
// This takes a viewport-relative vector and returns a vector whose values are
// between 0 and 1, representing the percentage position within the viewport.
-gfx::Vector2dF NormalizeFromViewport(gfx::Vector2dF denormalized,
+gfx::Vector2dF NormalizeFromViewport(const gfx::Vector2dF& denormalized,
const gfx::SizeF& viewport_size) {
return gfx::ScaleVector2d(denormalized,
1.f / viewport_size.width(),
1.f / viewport_size.height());
}
-gfx::Vector2dF DenormalizeToViewport(gfx::Vector2dF normalized,
+gfx::Vector2dF DenormalizeToViewport(const gfx::Vector2dF& normalized,
const gfx::SizeF& viewport_size) {
return gfx::ScaleVector2d(normalized,
viewport_size.width(),
viewport_size.height());
}
-gfx::Vector2dF InterpolateBetween(gfx::Vector2dF start,
- gfx::Vector2dF end,
+gfx::Vector2dF InterpolateBetween(const gfx::Vector2dF& start,
+ const gfx::Vector2dF& end,
float interp) {
return start + gfx::ScaleVector2d(end - start, interp);
}
@@ -41,7 +41,7 @@ gfx::Vector2dF InterpolateBetween(gfx::Vector2dF start,
namespace cc {
scoped_ptr<PageScaleAnimation> PageScaleAnimation::Create(
- gfx::Vector2dF start_scroll_offset,
+ const gfx::Vector2dF& start_scroll_offset,
float start_page_scale_factor,
const gfx::SizeF& viewport_size,
const gfx::SizeF& root_layer_size,
@@ -54,7 +54,7 @@ scoped_ptr<PageScaleAnimation> PageScaleAnimation::Create(
}
PageScaleAnimation::PageScaleAnimation(
- gfx::Vector2dF start_scroll_offset,
+ const gfx::Vector2dF& start_scroll_offset,
float start_page_scale_factor,
const gfx::SizeF& viewport_size,
const gfx::SizeF& root_layer_size,
@@ -72,7 +72,7 @@ PageScaleAnimation::PageScaleAnimation(
PageScaleAnimation::~PageScaleAnimation() {}
-void PageScaleAnimation::ZoomTo(gfx::Vector2dF target_scroll_offset,
+void PageScaleAnimation::ZoomTo(const gfx::Vector2dF& target_scroll_offset,
float target_page_scale_factor,
double duration) {
target_page_scale_factor_ = target_page_scale_factor;
@@ -92,7 +92,7 @@ void PageScaleAnimation::ZoomTo(gfx::Vector2dF target_scroll_offset,
start_anchor_ = target_anchor_;
}
-void PageScaleAnimation::ZoomWithAnchor(gfx::Vector2dF anchor,
+void PageScaleAnimation::ZoomWithAnchor(const gfx::Vector2dF& anchor,
float target_page_scale_factor,
double duration) {
start_anchor_ = anchor;
diff --git a/cc/input/page_scale_animation.h b/cc/input/page_scale_animation.h
index f2e315d..c7856e1 100644
--- a/cc/input/page_scale_animation.h
+++ b/cc/input/page_scale_animation.h
@@ -25,7 +25,7 @@ class PageScaleAnimation {
public:
// Construct with the state at the beginning of the animation.
static scoped_ptr<PageScaleAnimation> Create(
- gfx::Vector2dF start_scroll_offset,
+ const gfx::Vector2dF& start_scroll_offset,
float start_page_scale_factor,
const gfx::SizeF& viewport_size,
const gfx::SizeF& root_layer_size,
@@ -37,7 +37,7 @@ class PageScaleAnimation {
// immediately after construction to set the final scroll and page scale.
// Zoom while explicitly specifying the top-left scroll position.
- void ZoomTo(gfx::Vector2dF target_scroll_offset,
+ void ZoomTo(const gfx::Vector2dF& target_scroll_offset,
float target_page_scale_factor,
double duration);
@@ -45,7 +45,7 @@ class PageScaleAnimation {
// at the same position on the physical display throughout the animation,
// unless the edges of the root layer are hit. The anchor is specified
// as an offset from the content layer.
- void ZoomWithAnchor(gfx::Vector2dF anchor,
+ void ZoomWithAnchor(const gfx::Vector2dF& anchor,
float target_page_scale_factor,
double duration);
@@ -69,7 +69,7 @@ class PageScaleAnimation {
float target_page_scale_factor() const { return target_page_scale_factor_; }
protected:
- PageScaleAnimation(gfx::Vector2dF start_scroll_offset,
+ PageScaleAnimation(const gfx::Vector2dF& start_scroll_offset,
float start_page_scale_factor,
const gfx::SizeF& viewport_size,
const gfx::SizeF& root_layer_size,
diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc
index 871d9e6..07a9e19 100644
--- a/cc/input/top_controls_manager.cc
+++ b/cc/input/top_controls_manager.cc
@@ -98,7 +98,7 @@ void TopControlsManager::ScrollBegin() {
}
gfx::Vector2dF TopControlsManager::ScrollBy(
- const gfx::Vector2dF pending_delta) {
+ const gfx::Vector2dF& pending_delta) {
if (pinch_gesture_active_)
return pending_delta;
diff --git a/cc/input/top_controls_manager.h b/cc/input/top_controls_manager.h
index 246efba..7d631d8 100644
--- a/cc/input/top_controls_manager.h
+++ b/cc/input/top_controls_manager.h
@@ -53,7 +53,7 @@ class CC_EXPORT TopControlsManager
bool animate);
void ScrollBegin();
- gfx::Vector2dF ScrollBy(const gfx::Vector2dF pending_delta);
+ gfx::Vector2dF ScrollBy(const gfx::Vector2dF& pending_delta);
void ScrollEnd();
// The caller should ensure that |Pinch{Begin,End}| are called within
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 045ea73..f585006 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -1066,7 +1066,7 @@ void Layer::OnTransformAnimated(const gfx::Transform& transform) {
transform_ = transform;
}
-void Layer::OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) {
+void Layer::OnScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset) {
// Do nothing. Scroll deltas will be sent from the compositor thread back
// to the main thread in the same manner as during non-animated
// compositor-driven scrolling.
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 6d9619f..5f9caf6 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -550,7 +550,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE;
virtual void OnOpacityAnimated(float opacity) OVERRIDE;
virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
- virtual void OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) OVERRIDE;
+ virtual void OnScrollOffsetAnimated(
+ const gfx::Vector2dF& scroll_offset) OVERRIDE;
virtual void OnAnimationWaitingForDeletion() OVERRIDE;
virtual bool IsActive() const OVERRIDE;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index a783a78..7444b77 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -376,7 +376,7 @@ void LayerImpl::SetSentScrollDelta(gfx::Vector2d sent_scroll_delta) {
sent_scroll_delta_ = sent_scroll_delta;
}
-gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) {
+gfx::Vector2dF LayerImpl::ScrollBy(const gfx::Vector2dF& scroll) {
DCHECK(scrollable());
gfx::Vector2dF min_delta = -scroll_offset_;
gfx::Vector2dF max_delta = max_scroll_offset_ - scroll_offset_;
@@ -731,7 +731,7 @@ void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) {
SetTransform(transform);
}
-void LayerImpl::OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) {
+void LayerImpl::OnScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset) {
// Only layers in the active tree should need to do anything here, since
// layers in the pending tree will find out about these changes as a
// result of the call to SetScrollDelta.
@@ -1092,7 +1092,7 @@ void LayerImpl::SetScrollOffset(gfx::Vector2d scroll_offset) {
}
void LayerImpl::SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
- gfx::Vector2dF scroll_delta) {
+ const gfx::Vector2dF& scroll_delta) {
bool changed = false;
if (scroll_offset_ != scroll_offset) {
@@ -1139,7 +1139,7 @@ gfx::Vector2dF LayerImpl::ScrollDelta() const {
return scroll_delta_;
}
-void LayerImpl::SetScrollDelta(gfx::Vector2dF scroll_delta) {
+void LayerImpl::SetScrollDelta(const gfx::Vector2dF& scroll_delta) {
SetScrollOffsetAndDelta(scroll_offset_, scroll_delta);
}
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 039c674e..75f02ec 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -83,7 +83,8 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE;
virtual void OnOpacityAnimated(float opacity) OVERRIDE;
virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
- virtual void OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) OVERRIDE;
+ virtual void OnScrollOffsetAnimated(
+ const gfx::Vector2dF& scroll_offset) OVERRIDE;
virtual void OnAnimationWaitingForDeletion() OVERRIDE;
virtual bool IsActive() const OVERRIDE;
@@ -244,7 +245,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
return is_container_for_fixed_position_layers_;
}
- void SetFixedContainerSizeDelta(gfx::Vector2dF delta) {
+ void SetFixedContainerSizeDelta(const gfx::Vector2dF& delta) {
fixed_container_size_delta_ = delta;
}
gfx::Vector2dF fixed_container_size_delta() const {
@@ -369,13 +370,13 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
void SetScrollOffset(gfx::Vector2d scroll_offset);
void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
- gfx::Vector2dF scroll_delta);
+ const gfx::Vector2dF& scroll_delta);
gfx::Vector2d scroll_offset() const { return scroll_offset_; }
void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset);
gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; }
- void SetScrollDelta(gfx::Vector2dF scroll_delta);
+ void SetScrollDelta(const gfx::Vector2dF& scroll_delta);
gfx::Vector2dF ScrollDelta() const;
gfx::Vector2dF TotalScrollOffset() const;
@@ -385,7 +386,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
// Returns the delta of the scroll that was outside of the bounds of the
// initial scroll
- gfx::Vector2dF ScrollBy(gfx::Vector2dF scroll);
+ gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
void SetScrollable(bool scrollable) { scrollable_ = scrollable; }
bool scrollable() const { return scrollable_; }
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 43691ca..f38809f 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -452,14 +452,15 @@ TEST_F(LayerImplScrollTest, ScrollByWithNonZeroOffset) {
class ScrollDelegateIgnore : public LayerScrollOffsetDelegate {
public:
- virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) OVERRIDE {}
- virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE {}
+ virtual void SetMaxScrollOffset(
+ const gfx::Vector2dF& max_scroll_offset) OVERRIDE {}
+ virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) OVERRIDE {}
virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE {
return fixed_offset_;
}
virtual bool IsExternalFlingActive() const OVERRIDE { return false; }
- void set_fixed_offset(gfx::Vector2dF fixed_offset) {
+ void set_fixed_offset(const gfx::Vector2dF& fixed_offset) {
fixed_offset_ = fixed_offset;
}
@@ -507,8 +508,9 @@ TEST_F(LayerImplScrollTest, ScrollByWithIgnoringDelegate) {
class ScrollDelegateAccept : public LayerScrollOffsetDelegate {
public:
- virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) OVERRIDE {}
- virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE {
+ virtual void SetMaxScrollOffset(
+ const gfx::Vector2dF& max_scroll_offset) OVERRIDE {}
+ virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) OVERRIDE {
current_offset_ = new_value;
}
virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE {
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index 01e33bb..a9a674f 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -200,7 +200,7 @@ void FakeLayerAnimationValueObserver::OnTransformAnimated(
}
void FakeLayerAnimationValueObserver::OnScrollOffsetAnimated(
- gfx::Vector2dF scroll_offset) {
+ const gfx::Vector2dF& scroll_offset) {
scroll_offset_ = scroll_offset;
}
diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h
index 1205bf3..e23be0b 100644
--- a/cc/test/animation_test_common.h
+++ b/cc/test/animation_test_common.h
@@ -75,7 +75,8 @@ class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver {
virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE;
virtual void OnOpacityAnimated(float opacity) OVERRIDE;
virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
- virtual void OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) OVERRIDE;
+ virtual void OnScrollOffsetAnimated(
+ const gfx::Vector2dF& scroll_offset) OVERRIDE;
virtual void OnAnimationWaitingForDeletion() OVERRIDE;
virtual bool IsActive() const OVERRIDE;
@@ -106,7 +107,7 @@ class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider {
public:
virtual gfx::Vector2dF ScrollOffsetForAnimation() const OVERRIDE;
- void set_scroll_offset(gfx::Vector2dF scroll_offset) {
+ void set_scroll_offset(const gfx::Vector2dF& scroll_offset) {
scroll_offset_ = scroll_offset;
}
diff --git a/cc/trees/layer_sorter.cc b/cc/trees/layer_sorter.cc
index 9287f19..e171fe0 100644
--- a/cc/trees/layer_sorter.cc
+++ b/cc/trees/layer_sorter.cc
@@ -23,7 +23,8 @@ namespace cc {
// the test scene went away.
const float k_layer_epsilon = 1e-4f;
-inline static float PerpProduct(gfx::Vector2dF u, gfx::Vector2dF v) {
+inline static float PerpProduct(const gfx::Vector2dF& u,
+ const gfx::Vector2dF& v) {
return u.x() * v.y() - u.y() * v.x();
}
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 5e97f14..c4baca8 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -672,7 +672,7 @@ static bool SubtreeShouldRenderToSeparateSurface(
gfx::Transform ComputeSizeDeltaCompensation(
LayerImpl* layer,
LayerImpl* container,
- gfx::Vector2dF position_offset) {
+ const gfx::Vector2dF& position_offset) {
gfx::Transform result_transform;
// To apply a translate in the container's layer space,
@@ -775,7 +775,7 @@ void ApplyPositionAdjustment(
gfx::Transform ComputeScrollCompensationForThisLayer(
LayerImpl* scrolling_layer,
const gfx::Transform& parent_matrix,
- gfx::Vector2dF scroll_delta) {
+ const gfx::Vector2dF& scroll_delta) {
// For every layer that has non-zero scroll_delta, we have to compute a
// transform that can undo the scroll_delta translation. In particular, we
// want this matrix to premultiply a fixed-position layer's parent_matrix, so
@@ -815,7 +815,7 @@ gfx::Transform ComputeScrollCompensationMatrixForChildren(
Layer* current_layer,
const gfx::Transform& current_parent_matrix,
const gfx::Transform& current_scroll_compensation,
- gfx::Vector2dF scroll_delta) {
+ const gfx::Vector2dF& scroll_delta) {
// The main thread (i.e. Layer) does not need to worry about scroll
// compensation. So we can just return an identity matrix here.
return gfx::Transform();
@@ -825,7 +825,7 @@ gfx::Transform ComputeScrollCompensationMatrixForChildren(
LayerImpl* layer,
const gfx::Transform& parent_matrix,
const gfx::Transform& current_scroll_compensation_matrix,
- gfx::Vector2dF scroll_delta) {
+ const gfx::Vector2dF& scroll_delta) {
// "Total scroll compensation" is the transform needed to cancel out all
// scroll_delta translations that occurred since the nearest container layer,
// even if there are render_surfaces in-between.
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index c33d77a..9063caf 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2069,7 +2069,7 @@ gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta(
LayerImpl* layer_impl,
float scale_from_viewport_to_screen_space,
const gfx::PointF& viewport_point,
- gfx::Vector2dF viewport_delta) {
+ const gfx::Vector2dF& viewport_delta) {
// Layers with non-invertible screen space transforms should not have passed
// the scroll hit test in the first place.
DCHECK(layer_impl->screen_space_transform().IsInvertible());
@@ -2142,14 +2142,14 @@ gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta(
}
static gfx::Vector2dF ScrollLayerWithLocalDelta(LayerImpl* layer_impl,
- gfx::Vector2dF local_delta) {
+ const gfx::Vector2dF& local_delta) {
gfx::Vector2dF previous_delta(layer_impl->ScrollDelta());
layer_impl->ScrollBy(local_delta);
return layer_impl->ScrollDelta() - previous_delta;
}
bool LayerTreeHostImpl::ScrollBy(gfx::Point viewport_point,
- gfx::Vector2dF scroll_delta) {
+ const gfx::Vector2dF& scroll_delta) {
TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
if (!CurrentlyScrollingLayer())
return false;
@@ -2350,7 +2350,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
return ScrollStarted;
}
-void LayerTreeHostImpl::NotifyCurrentFlingVelocity(gfx::Vector2dF velocity) {
+void LayerTreeHostImpl::NotifyCurrentFlingVelocity(
+ const gfx::Vector2dF& velocity) {
current_fling_velocity_ = velocity;
}
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index e4fb088..2b85e32 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -114,7 +114,7 @@ class CC_EXPORT LayerTreeHostImpl
gfx::Point viewport_point,
InputHandler::ScrollInputType type) OVERRIDE;
virtual bool ScrollBy(gfx::Point viewport_point,
- gfx::Vector2dF scroll_delta) OVERRIDE;
+ const gfx::Vector2dF& scroll_delta) OVERRIDE;
virtual bool ScrollVerticallyByPage(gfx::Point viewport_point,
ScrollDirection direction) OVERRIDE;
virtual void SetRootLayerScrollOffsetDelegate(
@@ -122,7 +122,8 @@ class CC_EXPORT LayerTreeHostImpl
virtual void OnRootLayerDelegatedScrollOffsetChanged() OVERRIDE;
virtual void ScrollEnd() OVERRIDE;
virtual InputHandler::ScrollStatus FlingScrollBegin() OVERRIDE;
- virtual void NotifyCurrentFlingVelocity(gfx::Vector2dF velocity) OVERRIDE;
+ virtual void NotifyCurrentFlingVelocity(
+ const gfx::Vector2dF& velocity) OVERRIDE;
virtual void MouseMoveAt(gfx::Point viewport_point) OVERRIDE;
virtual void PinchGestureBegin() OVERRIDE;
virtual void PinchGestureUpdate(float magnify_delta,
@@ -471,7 +472,7 @@ class CC_EXPORT LayerTreeHostImpl
LayerImpl* layer_impl,
float scale_from_viewport_to_screen_space,
const gfx::PointF& viewport_point,
- gfx::Vector2dF viewport_delta);
+ const gfx::Vector2dF& viewport_delta);
void UpdateMaxScrollOffset();
void TrackDamageForAllSurfaces(
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 31294e0..4797541 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -2459,11 +2459,12 @@ class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate {
virtual ~TestScrollOffsetDelegate() {}
- virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) OVERRIDE {
+ virtual void SetMaxScrollOffset(
+ const gfx::Vector2dF& max_scroll_offset) OVERRIDE {
max_scroll_offset_ = max_scroll_offset;
}
- virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE {
+ virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) OVERRIDE {
last_set_scroll_offset_ = new_value;
}
@@ -2485,7 +2486,7 @@ class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate {
return last_set_scroll_offset_;
}
- void set_getter_return_value(gfx::Vector2dF value) {
+ void set_getter_return_value(const gfx::Vector2dF& value) {
getter_return_value_ = value;
}
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc
index 24299d5..95289805 100644
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc
@@ -212,13 +212,14 @@ void SynchronousCompositorImpl::DidActivatePendingTree() {
}
void SynchronousCompositorImpl::SetMaxScrollOffset(
- gfx::Vector2dF max_scroll_offset) {
+ const gfx::Vector2dF& max_scroll_offset) {
DCHECK(CalledOnValidThread());
if (compositor_client_)
compositor_client_->SetMaxRootLayerScrollOffset(max_scroll_offset);
}
-void SynchronousCompositorImpl::SetTotalScrollOffset(gfx::Vector2dF new_value) {
+void SynchronousCompositorImpl::SetTotalScrollOffset(
+ const gfx::Vector2dF& new_value) {
DCHECK(CalledOnValidThread());
if (compositor_client_)
compositor_client_->SetTotalRootLayerScrollOffset(new_value);
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.h b/content/browser/android/in_process/synchronous_compositor_impl.h
index 9d47504..3cf1b61 100644
--- a/content/browser/android/in_process/synchronous_compositor_impl.h
+++ b/content/browser/android/in_process/synchronous_compositor_impl.h
@@ -73,8 +73,9 @@ class SynchronousCompositorImpl
virtual void DidActivatePendingTree() OVERRIDE;
// LayerScrollOffsetDelegate
- virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) OVERRIDE;
- virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE;
+ virtual void SetMaxScrollOffset(
+ const gfx::Vector2dF& max_scroll_offset) OVERRIDE;
+ virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) OVERRIDE;
virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE;
virtual bool IsExternalFlingActive() const OVERRIDE;
virtual void SetTotalPageScaleFactor(float page_scale_factor) OVERRIDE;
diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc
index e3616ba..d307144 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -47,7 +47,8 @@ class MockInputHandler : public cc::InputHandler {
ScrollStatus(gfx::Point viewport_point,
cc::InputHandler::ScrollInputType type));
MOCK_METHOD2(ScrollBy,
- bool(gfx::Point viewport_point, gfx::Vector2dF scroll_delta));
+ bool(gfx::Point viewport_point,
+ const gfx::Vector2dF& scroll_delta));
MOCK_METHOD2(ScrollVerticallyByPage,
bool(gfx::Point viewport_point,
cc::ScrollDirection direction));
@@ -66,7 +67,8 @@ class MockInputHandler : public cc::InputHandler {
float page_scale,
base::TimeDelta duration) OVERRIDE {}
- virtual void NotifyCurrentFlingVelocity(gfx::Vector2dF velocity) OVERRIDE {}
+ virtual void NotifyCurrentFlingVelocity(
+ const gfx::Vector2dF& velocity) OVERRIDE {}
virtual void MouseMoveAt(gfx::Point mouse_position) OVERRIDE {}
MOCK_METHOD1(HaveTouchEventHandlersAt,