summaryrefslogtreecommitdiffstats
path: root/cc/layers
diff options
context:
space:
mode:
authorr.kasibhatla@samsung.com <r.kasibhatla@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 07:26:47 +0000
committerr.kasibhatla@samsung.com <r.kasibhatla@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 07:26:47 +0000
commit14bc5d68972f02676621c4d8087c428caff008c1 (patch)
tree8033616cbaceabbb6a921c7010c7ba5e63ced5e8 /cc/layers
parent54facd633172b6d39c4f22edd9b976a39f468c45 (diff)
downloadchromium_src-14bc5d68972f02676621c4d8087c428caff008c1.zip
chromium_src-14bc5d68972f02676621c4d8087c428caff008c1.tar.gz
chromium_src-14bc5d68972f02676621c4d8087c428caff008c1.tar.bz2
[#4] Pass gfx structs by const ref (gfx::PointF)
Avoid unneccessary copy of structures gfx::PointF 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 by value creates unneccessary overhead which should be avoided. BUG=159273 R=danakj, enne, piman Review URL: https://codereview.chromium.org/139233002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers')
-rw-r--r--cc/layers/layer.cc4
-rw-r--r--cc/layers/layer.h4
-rw-r--r--cc/layers/layer_impl.cc6
-rw-r--r--cc/layers/layer_impl.h6
-rw-r--r--cc/layers/layer_position_constraint_unittest.cc4
-rw-r--r--cc/layers/texture_layer.cc3
-rw-r--r--cc/layers/texture_layer.h2
-rw-r--r--cc/layers/texture_layer_impl.h4
-rw-r--r--cc/layers/ui_resource_layer.cc3
-rw-r--r--cc/layers/ui_resource_layer.h2
-rw-r--r--cc/layers/ui_resource_layer_impl.cc4
-rw-r--r--cc/layers/ui_resource_layer_impl.h2
12 files changed, 23 insertions, 21 deletions
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 31a8bb4..b826fbb 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -376,7 +376,7 @@ void Layer::RequestCopyOfOutput(
SetNeedsCommit();
}
-void Layer::SetAnchorPoint(gfx::PointF anchor_point) {
+void Layer::SetAnchorPoint(const gfx::PointF& anchor_point) {
DCHECK(IsPropertyChangeAllowed());
if (anchor_point_ == anchor_point)
return;
@@ -581,7 +581,7 @@ void Layer::SetContentsOpaque(bool opaque) {
SetNeedsCommit();
}
-void Layer::SetPosition(gfx::PointF position) {
+void Layer::SetPosition(const gfx::PointF& position) {
DCHECK(IsPropertyChangeAllowed());
if (position_ == position)
return;
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 0f6cd22..6d9619f 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -102,7 +102,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
return !copy_requests_.empty();
}
- void SetAnchorPoint(gfx::PointF anchor_point);
+ void SetAnchorPoint(const gfx::PointF& anchor_point);
gfx::PointF anchor_point() const { return anchor_point_; }
void SetAnchorPointZ(float anchor_point_z);
@@ -165,7 +165,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void SetContentsOpaque(bool opaque);
bool contents_opaque() const { return contents_opaque_; }
- void SetPosition(gfx::PointF position);
+ void SetPosition(const gfx::PointF& position);
gfx::PointF position() const { return position_; }
void SetIsContainerForFixedPositionLayers(bool container);
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 3909114..cf017a2 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -410,7 +410,7 @@ void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() {
}
InputHandler::ScrollStatus LayerImpl::TryScroll(
- gfx::PointF screen_space_point,
+ const gfx::PointF& screen_space_point,
InputHandler::ScrollInputType type) const {
if (should_scroll_on_main_thread()) {
TRACE_EVENT0("cc", "LayerImpl::TryScroll: Failed ShouldScrollOnMainThread");
@@ -790,7 +790,7 @@ void LayerImpl::SetHideLayerAndSubtree(bool hide) {
NoteLayerPropertyChangedForSubtree();
}
-void LayerImpl::SetAnchorPoint(gfx::PointF anchor_point) {
+void LayerImpl::SetAnchorPoint(const gfx::PointF& anchor_point) {
if (anchor_point_ == anchor_point)
return;
@@ -909,7 +909,7 @@ void LayerImpl::SetIsRootForIsolatedGroup(bool root) {
is_root_for_isolated_group_ = root;
}
-void LayerImpl::SetPosition(gfx::PointF position) {
+void LayerImpl::SetPosition(const gfx::PointF& position) {
if (position_ == position)
return;
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index f7f9785..ce05891 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -188,7 +188,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
bool force_render_surface() const { return force_render_surface_; }
void SetForceRenderSurface(bool force) { force_render_surface_ = force; }
- void SetAnchorPoint(gfx::PointF anchor_point);
+ void SetAnchorPoint(const gfx::PointF& anchor_point);
gfx::PointF anchor_point() const { return anchor_point_; }
void SetAnchorPointZ(float anchor_point_z);
@@ -232,7 +232,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
return is_root_for_isolated_group_;
}
- void SetPosition(gfx::PointF position);
+ void SetPosition(const gfx::PointF& position);
gfx::PointF position() const { return position_; }
void SetIsContainerForFixedPositionLayers(bool container) {
@@ -431,7 +431,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
bool DrawCheckerboardForMissingTiles() const;
InputHandler::ScrollStatus TryScroll(
- gfx::PointF screen_space_point,
+ const gfx::PointF& screen_space_point,
InputHandler::ScrollInputType type) const;
void SetDoubleSided(bool double_sided);
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index 8f6dcb1..57e4c1d 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -19,8 +19,8 @@ namespace {
void SetLayerPropertiesForTesting(LayerImpl* layer,
const gfx::Transform& transform,
const gfx::Transform& sublayer_transform,
- gfx::PointF anchor,
- gfx::PointF position,
+ const gfx::PointF& anchor,
+ const gfx::PointF& position,
gfx::Size bounds,
bool preserves3d) {
layer->SetTransform(transform);
diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc
index 195d05d..a638780 100644
--- a/cc/layers/texture_layer.cc
+++ b/cc/layers/texture_layer.cc
@@ -69,7 +69,8 @@ void TextureLayer::SetFlipped(bool flipped) {
SetNeedsCommit();
}
-void TextureLayer::SetUV(gfx::PointF top_left, gfx::PointF bottom_right) {
+void TextureLayer::SetUV(const gfx::PointF& top_left,
+ const gfx::PointF& bottom_right) {
if (uv_top_left_ == top_left && uv_bottom_right_ == bottom_right)
return;
uv_top_left_ = top_left;
diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h
index 5f13772..8565247 100644
--- a/cc/layers/texture_layer.h
+++ b/cc/layers/texture_layer.h
@@ -99,7 +99,7 @@ class CC_EXPORT TextureLayer : public Layer {
void SetFlipped(bool flipped);
// Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1).
- void SetUV(gfx::PointF top_left, gfx::PointF bottom_right);
+ void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right);
// Sets an opacity value per vertex. It will be multiplied by the layer
// opacity value.
diff --git a/cc/layers/texture_layer_impl.h b/cc/layers/texture_layer_impl.h
index 26dd385..8f5cab1 100644
--- a/cc/layers/texture_layer_impl.h
+++ b/cc/layers/texture_layer_impl.h
@@ -45,8 +45,8 @@ class CC_EXPORT TextureLayerImpl : public LayerImpl {
blend_background_color_ = blend;
}
void set_flipped(bool flipped) { flipped_ = flipped; }
- void set_uv_top_left(gfx::PointF top_left) { uv_top_left_ = top_left; }
- void set_uv_bottom_right(gfx::PointF bottom_right) {
+ void set_uv_top_left(const gfx::PointF& top_left) { uv_top_left_ = top_left; }
+ void set_uv_bottom_right(const gfx::PointF& bottom_right) {
uv_bottom_right_ = bottom_right;
}
diff --git a/cc/layers/ui_resource_layer.cc b/cc/layers/ui_resource_layer.cc
index 09b8d9a..b26ebaa 100644
--- a/cc/layers/ui_resource_layer.cc
+++ b/cc/layers/ui_resource_layer.cc
@@ -72,7 +72,8 @@ scoped_ptr<LayerImpl> UIResourceLayer::CreateLayerImpl(
return UIResourceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
}
-void UIResourceLayer::SetUV(gfx::PointF top_left, gfx::PointF bottom_right) {
+void UIResourceLayer::SetUV(const gfx::PointF& top_left,
+ const gfx::PointF& bottom_right) {
if (uv_top_left_ == top_left && uv_bottom_right_ == bottom_right)
return;
uv_top_left_ = top_left;
diff --git a/cc/layers/ui_resource_layer.h b/cc/layers/ui_resource_layer.h
index 69721a3..d99c073 100644
--- a/cc/layers/ui_resource_layer.h
+++ b/cc/layers/ui_resource_layer.h
@@ -32,7 +32,7 @@ class CC_EXPORT UIResourceLayer : public Layer {
void SetUIResourceId(UIResourceId resource_id);
// Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1).
- void SetUV(gfx::PointF top_left, gfx::PointF bottom_right);
+ void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right);
// Sets an opacity value per vertex. It will be multiplied by the layer
// opacity value.
diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc
index 2c9a286..8a45eaa 100644
--- a/cc/layers/ui_resource_layer_impl.cc
+++ b/cc/layers/ui_resource_layer_impl.cc
@@ -62,8 +62,8 @@ void UIResourceLayerImpl::SetImageBounds(gfx::Size image_bounds) {
NoteLayerPropertyChanged();
}
-void UIResourceLayerImpl::SetUV(gfx::PointF top_left,
- gfx::PointF bottom_right) {
+void UIResourceLayerImpl::SetUV(const gfx::PointF& top_left,
+ const gfx::PointF& bottom_right) {
if (uv_top_left_ == top_left && uv_bottom_right_ == bottom_right)
return;
uv_top_left_ = top_left;
diff --git a/cc/layers/ui_resource_layer_impl.h b/cc/layers/ui_resource_layer_impl.h
index 7f20050..b8b06d9 100644
--- a/cc/layers/ui_resource_layer_impl.h
+++ b/cc/layers/ui_resource_layer_impl.h
@@ -33,7 +33,7 @@ class CC_EXPORT UIResourceLayerImpl : public LayerImpl {
void SetImageBounds(gfx::Size image_bounds);
// Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1).
- void SetUV(gfx::PointF top_left, gfx::PointF bottom_right);
+ void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right);
// Sets an opacity value per vertex. It will be multiplied by the layer
// opacity value.