summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorajay.berwal@samsung.com <ajay.berwal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 09:18:42 +0000
committerajay.berwal@samsung.com <ajay.berwal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 09:18:42 +0000
commit243e4f1996a61098947b5f9ad1798d6b5412ef0b (patch)
tree647808bf21f492a652d54e8e15c12177ca04e824 /cc
parent1e7e41e75151197f026df35b9c01c4bc63bccef0 (diff)
downloadchromium_src-243e4f1996a61098947b5f9ad1798d6b5412ef0b.zip
chromium_src-243e4f1996a61098947b5f9ad1798d6b5412ef0b.tar.gz
chromium_src-243e4f1996a61098947b5f9ad1798d6b5412ef0b.tar.bz2
Pass gfx structs by const ref (gfx::Vector2d)
Avoid unneccessary copy of structures gfx::Vector2d 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::Vector2d) BUG=159273 Review URL: https://codereview.chromium.org/132163009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/input/input_handler.h2
-rw-r--r--cc/layers/layer.cc3
-rw-r--r--cc/layers/layer.h3
-rw-r--r--cc/layers/layer_impl.cc7
-rw-r--r--cc/layers/layer_impl.h7
-rw-r--r--cc/layers/tiled_layer.cc2
-rw-r--r--cc/output/direct_renderer.cc2
-rw-r--r--cc/output/direct_renderer.h2
-rw-r--r--cc/output/software_output_device.cc4
-rw-r--r--cc/output/software_output_device.h3
-rw-r--r--cc/resources/bitmap_content_layer_updater.cc11
-rw-r--r--cc/resources/bitmap_content_layer_updater.h4
-rw-r--r--cc/resources/bitmap_skpicture_content_layer_updater.cc2
-rw-r--r--cc/resources/bitmap_skpicture_content_layer_updater.h2
-rw-r--r--cc/resources/image_layer_updater.cc4
-rw-r--r--cc/resources/image_layer_updater.h4
-rw-r--r--cc/resources/layer_updater.h3
-rw-r--r--cc/resources/prioritized_resource.cc2
-rw-r--r--cc/resources/prioritized_resource.h2
-rw-r--r--cc/resources/resource_provider.cc2
-rw-r--r--cc/resources/resource_provider.h2
-rw-r--r--cc/resources/resource_update.cc2
-rw-r--r--cc/resources/resource_update.h2
-rw-r--r--cc/test/fake_layer_tree_host_client.h2
-rw-r--r--cc/test/layer_tree_test.cc2
-rw-r--r--cc/test/layer_tree_test.h3
-rw-r--r--cc/test/pixel_test.cc2
-rw-r--r--cc/test/pixel_test.h2
-rw-r--r--cc/test/tiled_layer_test_common.cc2
-rw-r--r--cc/test/tiled_layer_test_common.h2
-rw-r--r--cc/trees/layer_tree_host.cc2
-rw-r--r--cc/trees/layer_tree_host.h2
-rw-r--r--cc/trees/layer_tree_host_client.h2
-rw-r--r--cc/trees/layer_tree_host_impl.cc9
-rw-r--r--cc/trees/layer_tree_host_impl.h2
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc2
-rw-r--r--cc/trees/layer_tree_host_perftest.cc3
-rw-r--r--cc/trees/layer_tree_host_unittest.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc10
39 files changed, 62 insertions, 64 deletions
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index 987f7a6..e052a49 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -117,7 +117,7 @@ class CC_EXPORT InputHandler {
virtual void PinchGestureUpdate(float magnify_delta, gfx::Point anchor) = 0;
virtual void PinchGestureEnd() = 0;
- virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
+ virtual void StartPageScaleAnimation(const gfx::Vector2d& target_offset,
bool anchor_point,
float page_scale,
base::TimeDelta duration) = 0;
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index b485d0d..56850a8 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -693,7 +693,7 @@ void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) {
SetNeedsCommit();
}
-void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) {
+void Layer::SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset) {
DCHECK(IsPropertyChangeAllowed());
// This function only gets called during a BeginMainFrame, so there
// is no need to call SetNeedsUpdate here.
@@ -1204,5 +1204,4 @@ void Layer::RemoveFromClipTree() {
void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
benchmark->RunOnLayer(this);
}
-
} // namespace cc
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 15b0e00..1c0f27c 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -267,10 +267,9 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void SetScrollOffset(gfx::Vector2d scroll_offset);
gfx::Vector2d scroll_offset() const { return scroll_offset_; }
- void SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset);
+ void SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset);
gfx::Vector2d MaxScrollOffset() const;
-
void SetScrollClipLayerId(int clip_layer_id);
bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; }
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index e21cc13..a06884d 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -367,7 +367,7 @@ ResourceProvider::ResourceId LayerImpl::ContentsResourceId() const {
return 0;
}
-void LayerImpl::SetSentScrollDelta(gfx::Vector2d sent_scroll_delta) {
+void LayerImpl::SetSentScrollDelta(const gfx::Vector2d& sent_scroll_delta) {
// Pending tree never has sent scroll deltas
DCHECK(layer_tree_impl()->IsActiveTree());
@@ -1054,11 +1054,11 @@ bool LayerImpl::IsExternalFlingActive() const {
scroll_offset_delegate_->IsExternalFlingActive();
}
-void LayerImpl::SetScrollOffset(gfx::Vector2d scroll_offset) {
+void LayerImpl::SetScrollOffset(const gfx::Vector2d& scroll_offset) {
SetScrollOffsetAndDelta(scroll_offset, ScrollDelta());
}
-void LayerImpl::SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
+void LayerImpl::SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset,
const gfx::Vector2dF& scroll_delta) {
bool changed = false;
@@ -1478,5 +1478,4 @@ scoped_ptr<base::Value> LayerImpl::AsValue() const {
void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
benchmark->RunOnLayer(this);
}
-
} // namespace cc
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index bb4358f..a901a64 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -362,8 +362,8 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
LayerScrollOffsetDelegate* scroll_offset_delegate);
bool IsExternalFlingActive() const;
- void SetScrollOffset(gfx::Vector2d scroll_offset);
- void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
+ void SetScrollOffset(const gfx::Vector2d& scroll_offset);
+ void SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset,
const gfx::Vector2dF& scroll_delta);
gfx::Vector2d scroll_offset() const { return scroll_offset_; }
@@ -371,13 +371,12 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
gfx::Vector2dF ClampScrollToMaxScrollOffset();
void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
LayerImpl* scrollbar_clip_layer) const;
-
void SetScrollDelta(const gfx::Vector2dF& scroll_delta);
gfx::Vector2dF ScrollDelta() const;
gfx::Vector2dF TotalScrollOffset() const;
- void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta);
+ void SetSentScrollDelta(const gfx::Vector2d& sent_scroll_delta);
gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; }
// Returns the delta of the scroll that was outside of the bounds of the
diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc
index 2507470..d4ec763 100644
--- a/cc/layers/tiled_layer.cc
+++ b/cc/layers/tiled_layer.cc
@@ -686,7 +686,7 @@ void TiledLayer::ResetUpdateState() {
}
namespace {
-gfx::Rect ExpandRectByDelta(const gfx::Rect& rect, gfx::Vector2d delta) {
+gfx::Rect ExpandRectByDelta(const gfx::Rect& rect, const gfx::Vector2d& delta) {
int width = rect.width() + std::abs(delta.x());
int height = rect.height() + std::abs(delta.y());
int x = rect.x() + ((delta.x() < 0) ? delta.x() : 0);
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 06e2afb..5cb3d4d 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -139,7 +139,7 @@ DirectRenderer::~DirectRenderer() {}
bool DirectRenderer::CanReadPixels() const { return true; }
void DirectRenderer::SetEnlargePassTextureAmountForTesting(
- gfx::Vector2d amount) {
+ const gfx::Vector2d& amount) {
enlarge_pass_texture_amount_ = amount;
}
diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h
index 08b75a1..451c7d7 100644
--- a/cc/output/direct_renderer.h
+++ b/cc/output/direct_renderer.h
@@ -59,7 +59,7 @@ class CC_EXPORT DirectRenderer : public Renderer {
bool disable_picture_quad_image_filtering;
};
- void SetEnlargePassTextureAmountForTesting(gfx::Vector2d amount);
+ void SetEnlargePassTextureAmountForTesting(const gfx::Vector2d& amount);
protected:
DirectRenderer(RendererClient* client,
diff --git a/cc/output/software_output_device.cc b/cc/output/software_output_device.cc
index 9730f7d..d066f4c 100644
--- a/cc/output/software_output_device.cc
+++ b/cc/output/software_output_device.cc
@@ -48,8 +48,8 @@ void SoftwareOutputDevice::CopyToBitmap(
bitmap.extractSubset(output, gfx::RectToSkIRect(rect));
}
-void SoftwareOutputDevice::Scroll(
- gfx::Vector2d delta, const gfx::Rect& clip_rect) {
+void SoftwareOutputDevice::Scroll(const gfx::Vector2d& delta,
+ const gfx::Rect& clip_rect) {
NOTIMPLEMENTED();
}
diff --git a/cc/output/software_output_device.h b/cc/output/software_output_device.h
index 827210e..f03e964 100644
--- a/cc/output/software_output_device.h
+++ b/cc/output/software_output_device.h
@@ -55,8 +55,7 @@ class CC_EXPORT SoftwareOutputDevice {
// Blit the pixel content of the SoftwareOutputDevice by |delta| with the
// write clipped to |clip_rect|.
- virtual void Scroll(gfx::Vector2d delta,
- const gfx::Rect& clip_rect);
+ virtual void Scroll(const gfx::Vector2d& delta, const gfx::Rect& clip_rect);
// Discard the backing buffer in the surface provided by this instance.
virtual void DiscardBackbuffer() {}
diff --git a/cc/resources/bitmap_content_layer_updater.cc b/cc/resources/bitmap_content_layer_updater.cc
index 493b42e..6f2332b 100644
--- a/cc/resources/bitmap_content_layer_updater.cc
+++ b/cc/resources/bitmap_content_layer_updater.cc
@@ -21,10 +21,11 @@ BitmapContentLayerUpdater::Resource::Resource(
BitmapContentLayerUpdater::Resource::~Resource() {}
-void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
- const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
- bool partial_update) {
+void BitmapContentLayerUpdater::Resource::Update(
+ ResourceUpdateQueue* queue,
+ const gfx::Rect& source_rect,
+ const gfx::Vector2d& dest_offset,
+ bool partial_update) {
updater_->UpdateTexture(
queue, texture(), source_rect, dest_offset, partial_update);
}
@@ -88,7 +89,7 @@ void BitmapContentLayerUpdater::PrepareToUpdate(
void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
PrioritizedResource* texture,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) {
CHECK(canvas_);
ResourceUpdate upload = ResourceUpdate::Create(texture,
diff --git a/cc/resources/bitmap_content_layer_updater.h b/cc/resources/bitmap_content_layer_updater.h
index 1cb49c2..37d28ad 100644
--- a/cc/resources/bitmap_content_layer_updater.h
+++ b/cc/resources/bitmap_content_layer_updater.h
@@ -31,7 +31,7 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) OVERRIDE;
private:
@@ -55,7 +55,7 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
void UpdateTexture(ResourceUpdateQueue* queue,
PrioritizedResource* resource,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update);
virtual void SetOpaque(bool opaque) OVERRIDE;
virtual void ReduceMemoryUsage() OVERRIDE;
diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc
index 0ca48b4..20186ae 100644
--- a/cc/resources/bitmap_skpicture_content_layer_updater.cc
+++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc
@@ -22,7 +22,7 @@ BitmapSkPictureContentLayerUpdater::Resource::Resource(
void BitmapSkPictureContentLayerUpdater::Resource::Update(
ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) {
bitmap_.setConfig(
SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height(), 0,
diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.h b/cc/resources/bitmap_skpicture_content_layer_updater.h
index 6bdebcf..e20e3c3 100644
--- a/cc/resources/bitmap_skpicture_content_layer_updater.h
+++ b/cc/resources/bitmap_skpicture_content_layer_updater.h
@@ -22,7 +22,7 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) OVERRIDE;
private:
diff --git a/cc/resources/image_layer_updater.cc b/cc/resources/image_layer_updater.cc
index e6900b7..d5d62ed 100644
--- a/cc/resources/image_layer_updater.cc
+++ b/cc/resources/image_layer_updater.cc
@@ -16,7 +16,7 @@ ImageLayerUpdater::Resource::~Resource() {}
void ImageLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) {
updater_->UpdateTexture(
queue, texture(), source_rect, dest_offset, partial_update);
@@ -36,7 +36,7 @@ scoped_ptr<LayerUpdater::Resource> ImageLayerUpdater::CreateResource(
void ImageLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
PrioritizedResource* texture,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) {
// Source rect should never go outside the image pixels, even if this
// is requested because the texture extends outside the image.
diff --git a/cc/resources/image_layer_updater.h b/cc/resources/image_layer_updater.h
index 1b92a6f..b2235b1 100644
--- a/cc/resources/image_layer_updater.h
+++ b/cc/resources/image_layer_updater.h
@@ -23,7 +23,7 @@ class CC_EXPORT ImageLayerUpdater : public LayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) OVERRIDE;
private:
@@ -40,7 +40,7 @@ class CC_EXPORT ImageLayerUpdater : public LayerUpdater {
void UpdateTexture(ResourceUpdateQueue* queue,
PrioritizedResource* texture,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update);
void SetBitmap(const SkBitmap& bitmap);
diff --git a/cc/resources/layer_updater.h b/cc/resources/layer_updater.h
index d12d7b4..44c6765 100644
--- a/cc/resources/layer_updater.h
+++ b/cc/resources/layer_updater.h
@@ -30,8 +30,9 @@ class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> {
// instead of an argument passed to Update().
virtual void Update(ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) = 0;
+
protected:
explicit Resource(scoped_ptr<PrioritizedResource> texture);
diff --git a/cc/resources/prioritized_resource.cc b/cc/resources/prioritized_resource.cc
index 0fc705a..f1ae228 100644
--- a/cc/resources/prioritized_resource.cc
+++ b/cc/resources/prioritized_resource.cc
@@ -79,7 +79,7 @@ void PrioritizedResource::SetPixels(ResourceProvider* resource_provider,
const uint8_t* image,
const gfx::Rect& image_rect,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset) {
+ const gfx::Vector2d& dest_offset) {
DCHECK(is_above_priority_cutoff_);
if (is_above_priority_cutoff_)
AcquireBackingTexture(resource_provider);
diff --git a/cc/resources/prioritized_resource.h b/cc/resources/prioritized_resource.h
index cf8df6a..1d56524 100644
--- a/cc/resources/prioritized_resource.h
+++ b/cc/resources/prioritized_resource.h
@@ -81,7 +81,7 @@ class CC_EXPORT PrioritizedResource {
const uint8_t* image,
const gfx::Rect& image_rect,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset);
+ const gfx::Vector2d& dest_offset);
ResourceProvider::ResourceId resource_id() const {
return backing_ ? backing_->id() : 0;
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index e0adc91..30742ec 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -618,7 +618,7 @@ void ResourceProvider::SetPixels(ResourceId id,
const uint8_t* image,
const gfx::Rect& image_rect,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset) {
+ const gfx::Vector2d& dest_offset) {
Resource* resource = GetResource(id);
DCHECK(!resource->locked_for_write);
DCHECK(!resource->lock_for_read_count);
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index ac0baab..f2da5d8 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -137,7 +137,7 @@ class CC_EXPORT ResourceProvider {
const uint8_t* image,
const gfx::Rect& image_rect,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset);
+ const gfx::Vector2d& dest_offset);
// Check upload status.
size_t NumBlockingUploads();
diff --git a/cc/resources/resource_update.cc b/cc/resources/resource_update.cc
index f24962a..2fe8fe5 100644
--- a/cc/resources/resource_update.cc
+++ b/cc/resources/resource_update.cc
@@ -12,7 +12,7 @@ ResourceUpdate ResourceUpdate::Create(PrioritizedResource* resource,
const SkBitmap* bitmap,
const gfx::Rect& content_rect,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset) {
+ const gfx::Vector2d& dest_offset) {
CHECK(content_rect.Contains(source_rect));
ResourceUpdate update;
update.texture = resource;
diff --git a/cc/resources/resource_update.h b/cc/resources/resource_update.h
index fefceb8..1eddf83 100644
--- a/cc/resources/resource_update.h
+++ b/cc/resources/resource_update.h
@@ -20,7 +20,7 @@ struct CC_EXPORT ResourceUpdate {
const SkBitmap* bitmap,
const gfx::Rect& content_rect,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset);
+ const gfx::Vector2d& dest_offset);
ResourceUpdate();
virtual ~ResourceUpdate();
diff --git a/cc/test/fake_layer_tree_host_client.h b/cc/test/fake_layer_tree_host_client.h
index eac8d5e..c497b26 100644
--- a/cc/test/fake_layer_tree_host_client.h
+++ b/cc/test/fake_layer_tree_host_client.h
@@ -31,7 +31,7 @@ class FakeLayerTreeHostClient : public LayerTreeHostClient,
virtual void DidBeginMainFrame() OVERRIDE {}
virtual void Animate(double frame_begin_time) OVERRIDE {}
virtual void Layout() OVERRIDE {}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE {}
virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) OVERRIDE;
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index a253782..333814d 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -226,7 +226,7 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient,
virtual void Layout() OVERRIDE { test_hooks_->Layout(); }
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) OVERRIDE {
test_hooks_->ApplyScrollAndScale(scroll_delta, scale);
}
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index a3eaec4..0a047fa 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -60,7 +60,8 @@ class TestHooks : public AnimationDelegate {
bool has_unfinished_animation) {}
virtual void WillAnimateLayers(LayerTreeHostImpl* host_impl,
base::TimeTicks monotonic_time) {}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) {}
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
+ float scale) {}
virtual void Animate(base::TimeTicks monotonic_time) {}
virtual void WillBeginMainFrame() {}
virtual void DidBeginMainFrame() {}
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 38a2b54..0a31bb0 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -144,7 +144,7 @@ void PixelTest::ForceExpandedViewport(const gfx::Size& surface_expansion) {
}
}
-void PixelTest::ForceViewportOffset(gfx::Vector2d viewport_offset) {
+void PixelTest::ForceViewportOffset(const gfx::Vector2d& viewport_offset) {
external_device_viewport_offset_ = viewport_offset;
}
diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h
index 6d5c552..f902613 100644
--- a/cc/test/pixel_test.h
+++ b/cc/test/pixel_test.h
@@ -60,7 +60,7 @@ class PixelTest : public testing::Test, RendererClient {
void SetUpSoftwareRenderer();
void ForceExpandedViewport(const gfx::Size& surface_expansion);
- void ForceViewportOffset(gfx::Vector2d viewport_offset);
+ void ForceViewportOffset(const gfx::Vector2d& viewport_offset);
void ForceDeviceClip(const gfx::Rect& clip);
void EnableExternalStencilTest();
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index e39765e..a0dbfc7 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -17,7 +17,7 @@ FakeLayerUpdater::Resource::~Resource() {}
void FakeLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) {
const gfx::Rect kRect(0, 0, 10, 10);
ResourceUpdate upload = ResourceUpdate::Create(
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index c61e0ec..2c36d12 100644
--- a/cc/test/tiled_layer_test_common.h
+++ b/cc/test/tiled_layer_test_common.h
@@ -29,7 +29,7 @@ class FakeLayerUpdater : public LayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
const gfx::Rect& source_rect,
- gfx::Vector2d dest_offset,
+ const gfx::Vector2d& dest_offset,
bool partial_update) OVERRIDE;
private:
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index e67e269..34f4911 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -693,7 +693,7 @@ void LayerTreeHost::SetVisible(bool visible) {
proxy_->SetVisible(visible);
}
-void LayerTreeHost::StartPageScaleAnimation(gfx::Vector2d target_offset,
+void LayerTreeHost::StartPageScaleAnimation(const gfx::Vector2d& target_offset,
bool use_anchor,
float scale,
base::TimeDelta duration) {
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index c33608b..1a2a65b 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -235,7 +235,7 @@ class CC_EXPORT LayerTreeHost {
void SetVisible(bool visible);
bool visible() const { return visible_; }
- void StartPageScaleAnimation(gfx::Vector2d target_offset,
+ void StartPageScaleAnimation(const gfx::Vector2d& target_offset,
bool use_anchor,
float scale,
base::TimeDelta duration);
diff --git a/cc/trees/layer_tree_host_client.h b/cc/trees/layer_tree_host_client.h
index 2e3023a..0327be9 100644
--- a/cc/trees/layer_tree_host_client.h
+++ b/cc/trees/layer_tree_host_client.h
@@ -25,7 +25,7 @@ class LayerTreeHostClient {
virtual void DidBeginMainFrame() = 0;
virtual void Animate(double frame_begin_time) = 0;
virtual void Layout() = 0;
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) = 0;
// Creates an OutputSurface. If fallback is true, it should attempt to
// create an OutputSurface that is guaranteed to initialize correctly.
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 121e824..f05a270 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -427,10 +427,11 @@ void LayerTreeHostImpl::ManageTiles() {
client_->DidManageTiles();
}
-void LayerTreeHostImpl::StartPageScaleAnimation(gfx::Vector2d target_offset,
- bool anchor_point,
- float page_scale,
- base::TimeDelta duration) {
+void LayerTreeHostImpl::StartPageScaleAnimation(
+ const gfx::Vector2d& target_offset,
+ bool anchor_point,
+ float page_scale,
+ base::TimeDelta duration) {
if (!InnerViewportScrollLayer())
return;
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index fe83af5..f6993cb 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -130,7 +130,7 @@ class CC_EXPORT LayerTreeHostImpl
virtual void PinchGestureUpdate(float magnify_delta,
gfx::Point anchor) OVERRIDE;
virtual void PinchGestureEnd() OVERRIDE;
- virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
+ virtual void StartPageScaleAnimation(const gfx::Vector2d& target_offset,
bool anchor_point,
float page_scale,
base::TimeDelta duration) OVERRIDE;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index e41726d..6c13418 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -179,7 +179,7 @@ class LayerTreeHostImplTest : public testing::Test,
static void ExpectContains(const ScrollAndScaleSet& scroll_info,
int id,
- gfx::Vector2d scroll_delta) {
+ const gfx::Vector2d& scroll_delta) {
int times_encountered = 0;
for (size_t i = 0; i < scroll_info.scrolls.size(); ++i) {
diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc
index 7ca0f51..9202fbf 100644
--- a/cc/trees/layer_tree_host_perftest.cc
+++ b/cc/trees/layer_tree_host_perftest.cc
@@ -352,8 +352,7 @@ class PageScaleImplSidePaintingPerfTest
layer_tree_host()->RegisterViewportLayers(
root, inner_viewport_scroll_layer, 0);
}
-
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale_delta) OVERRIDE {
float page_scale_factor = layer_tree_host()->page_scale_factor();
page_scale_factor *= scale_delta;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 547cd54..5689e1a 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1158,7 +1158,7 @@ class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest {
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) OVERRIDE {
gfx::Vector2d offset = scroll_layer_->scroll_offset();
scroll_layer_->SetScrollOffset(offset + scroll_delta);
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index 52bcaf9..cf2ac87 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -83,7 +83,7 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest {
}
}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) OVERRIDE {
num_scrolls_++;
}
@@ -167,7 +167,7 @@ class LayerTreeHostScrollTestScrollMultipleRedraw
}
}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) OVERRIDE {
num_scrolls_++;
}
@@ -331,7 +331,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit
}
}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) OVERRIDE {
num_impl_scrolls_++;
}
@@ -504,7 +504,7 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest {
final_scroll_offset_ = expected_scroll_layer_->scroll_offset();
}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) OVERRIDE {
num_scrolls_++;
}
@@ -864,7 +864,7 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest {
}
}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) OVERRIDE {
num_scrolls_++;
}