summaryrefslogtreecommitdiffstats
path: root/cc/test
diff options
context:
space:
mode:
authorprashant.n@samsung.com <prashant.n@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-29 22:58:26 +0000
committerprashant.n@samsung.com <prashant.n@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-29 22:58:26 +0000
commit64348eae94a2d07e923aaa0262b6c47947ffa3b3 (patch)
treec75d0c39b289b4a2543426bbe4461cc3e7117c46 /cc/test
parent44ea5317cf5920949c483be09f2931ae20cf23d1 (diff)
downloadchromium_src-64348eae94a2d07e923aaa0262b6c47947ffa3b3.zip
chromium_src-64348eae94a2d07e923aaa0262b6c47947ffa3b3.tar.gz
chromium_src-64348eae94a2d07e923aaa0262b6c47947ffa3b3.tar.bz2
[#7] Pass gfx::Size by const ref.
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 and some other scenarios mentioned in the bug. BUG=159273 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=247426 Review URL: https://codereview.chromium.org/145313006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r--cc/test/fake_picture_layer_impl.cc2
-rw-r--r--cc/test/fake_picture_layer_impl.h5
-rw-r--r--cc/test/fake_picture_layer_tiling_client.cc4
-rw-r--r--cc/test/fake_picture_layer_tiling_client.h4
-rw-r--r--cc/test/fake_picture_pile_impl.cc12
-rw-r--r--cc/test/fake_picture_pile_impl.h12
-rw-r--r--cc/test/layer_tree_pixel_test.cc2
-rw-r--r--cc/test/layer_tree_pixel_test.h2
-rw-r--r--cc/test/pixel_test.cc2
-rw-r--r--cc/test/pixel_test.h2
-rw-r--r--cc/test/pixel_test_output_surface.cc3
-rw-r--r--cc/test/pixel_test_output_surface.h4
-rw-r--r--cc/test/pixel_test_software_output_device.cc2
-rw-r--r--cc/test/pixel_test_software_output_device.h4
-rw-r--r--cc/test/skia_common.cc2
-rw-r--r--cc/test/skia_common.h2
-rw-r--r--cc/test/test_texture.cc4
-rw-r--r--cc/test/test_texture.h4
-rw-r--r--cc/test/tiled_layer_test_common.cc4
-rw-r--r--cc/test/tiled_layer_test_common.h4
20 files changed, 41 insertions, 39 deletions
diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc
index 6e9ffde..4241ae0 100644
--- a/cc/test/fake_picture_layer_impl.cc
+++ b/cc/test/fake_picture_layer_impl.cc
@@ -36,7 +36,7 @@ void FakePictureLayerImpl::AppendQuads(QuadSink* quad_sink,
}
gfx::Size FakePictureLayerImpl::CalculateTileSize(
- gfx::Size content_bounds) const {
+ const gfx::Size& content_bounds) const {
if (fixed_tile_size_.IsEmpty()) {
return PictureLayerImpl::CalculateTileSize(content_bounds);
}
diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h
index a289934..477b6b9 100644
--- a/cc/test/fake_picture_layer_impl.h
+++ b/cc/test/fake_picture_layer_impl.h
@@ -26,7 +26,8 @@ class FakePictureLayerImpl : public PictureLayerImpl {
OVERRIDE;
virtual void AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) OVERRIDE;
- virtual gfx::Size CalculateTileSize(gfx::Size content_bounds) const OVERRIDE;
+ virtual gfx::Size CalculateTileSize(
+ const gfx::Size& content_bounds) const OVERRIDE;
using PictureLayerImpl::AddTiling;
using PictureLayerImpl::CleanUpTilingsOnActiveLayer;
@@ -54,7 +55,7 @@ class FakePictureLayerImpl : public PictureLayerImpl {
const Region& invalidation() const { return invalidation_; }
void set_invalidation(const Region& region) { invalidation_ = region; }
- void set_fixed_tile_size(gfx::Size size) { fixed_tile_size_ = size; }
+ void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; }
void CreateDefaultTilingsAndTiles();
void SetAllTilesVisible();
diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc
index acbd791..f891b9e 100644
--- a/cc/test/fake_picture_layer_tiling_client.cc
+++ b/cc/test/fake_picture_layer_tiling_client.cc
@@ -49,12 +49,12 @@ scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
pile_.get(), tile_size_, rect, gfx::Rect(), 1, 0, 0, Tile::USE_LCD_TEXT);
}
-void FakePictureLayerTilingClient::SetTileSize(gfx::Size tile_size) {
+void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) {
tile_size_ = tile_size;
}
gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
- gfx::Size /* content_bounds */) const {
+ const gfx::Size& /* content_bounds */) const {
return tile_size_;
}
diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h
index 2e4e9d6..6383a22 100644
--- a/cc/test/fake_picture_layer_tiling_client.h
+++ b/cc/test/fake_picture_layer_tiling_client.h
@@ -25,9 +25,9 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
PictureLayerTiling* tiling, const gfx::Rect& rect) OVERRIDE;
virtual void UpdatePile(Tile* tile) OVERRIDE {}
virtual gfx::Size CalculateTileSize(
- gfx::Size content_bounds) const OVERRIDE;
+ const gfx::Size& content_bounds) const OVERRIDE;
- void SetTileSize(gfx::Size tile_size);
+ void SetTileSize(const gfx::Size& tile_size);
gfx::Size TileSize() const { return tile_size_; }
scoped_refptr<PicturePileImpl> pile() { return pile_; }
const PicturePileImpl* pile() const { return pile_.get(); }
diff --git a/cc/test/fake_picture_pile_impl.cc b/cc/test/fake_picture_pile_impl.cc
index bc751ed..9b168e6 100644
--- a/cc/test/fake_picture_pile_impl.cc
+++ b/cc/test/fake_picture_pile_impl.cc
@@ -17,8 +17,8 @@ FakePicturePileImpl::FakePicturePileImpl() {}
FakePicturePileImpl::~FakePicturePileImpl() {}
scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile(
- gfx::Size tile_size,
- gfx::Size layer_bounds) {
+ const gfx::Size& tile_size,
+ const gfx::Size& layer_bounds) {
scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
pile->tiling().SetTotalSize(layer_bounds);
pile->tiling().SetMaxTextureSize(tile_size);
@@ -32,8 +32,8 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile(
}
scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile(
- gfx::Size tile_size,
- gfx::Size layer_bounds) {
+ const gfx::Size& tile_size,
+ const gfx::Size& layer_bounds) {
scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
pile->tiling().SetTotalSize(layer_bounds);
pile->tiling().SetMaxTextureSize(tile_size);
@@ -44,8 +44,8 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile(
scoped_refptr<FakePicturePileImpl>
FakePicturePileImpl::CreatePileWithRecordedRegion(
- gfx::Size tile_size,
- gfx::Size layer_bounds,
+ const gfx::Size& tile_size,
+ const gfx::Size& layer_bounds,
const Region& recorded_region) {
scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
pile->tiling().SetTotalSize(layer_bounds);
diff --git a/cc/test/fake_picture_pile_impl.h b/cc/test/fake_picture_pile_impl.h
index 20d44e3..ae424bb 100644
--- a/cc/test/fake_picture_pile_impl.h
+++ b/cc/test/fake_picture_pile_impl.h
@@ -14,16 +14,16 @@ namespace cc {
class FakePicturePileImpl : public PicturePileImpl {
public:
static scoped_refptr<FakePicturePileImpl> CreateFilledPile(
- gfx::Size tile_size,
- gfx::Size layer_bounds);
+ const gfx::Size& tile_size,
+ const gfx::Size& layer_bounds);
static scoped_refptr<FakePicturePileImpl> CreateEmptyPile(
- gfx::Size tile_size,
- gfx::Size layer_bounds);
+ const gfx::Size& tile_size,
+ const gfx::Size& layer_bounds);
static scoped_refptr<FakePicturePileImpl> CreatePileWithRecordedRegion(
- gfx::Size tile_size,
- gfx::Size layer_bounds,
+ const gfx::Size& tile_size,
+ const gfx::Size& layer_bounds,
const Region& recorded_region);
static scoped_refptr<FakePicturePileImpl> CreatePile();
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc
index 806b877..c5d2125 100644
--- a/cc/test/layer_tree_pixel_test.cc
+++ b/cc/test/layer_tree_pixel_test.cc
@@ -228,7 +228,7 @@ void LayerTreePixelTest::SetupTree() {
}
scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap(
- gfx::Size size,
+ const gfx::Size& size,
const TextureMailbox& texture_mailbox) {
DCHECK(texture_mailbox.IsTexture());
if (!texture_mailbox.IsTexture())
diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h
index a72f1db..426cd02 100644
--- a/cc/test/layer_tree_pixel_test.h
+++ b/cc/test/layer_tree_pixel_test.h
@@ -75,7 +75,7 @@ class LayerTreePixelTest : public LayerTreeTest {
base::FilePath file_name);
scoped_ptr<SkBitmap> CopyTextureMailboxToBitmap(
- gfx::Size size,
+ const gfx::Size& size,
const TextureMailbox& texture_mailbox);
void CopyBitmapToTextureMailboxAsTexture(
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 1257be6..e84540e 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -137,7 +137,7 @@ void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) {
0).PassAs<DirectRenderer>();
}
-void PixelTest::ForceExpandedViewport(gfx::Size surface_expansion) {
+void PixelTest::ForceExpandedViewport(const gfx::Size& surface_expansion) {
static_cast<PixelTestOutputSurface*>(output_surface_.get())
->set_surface_expansion_size(surface_expansion);
SoftwareOutputDevice* device = output_surface_->software_device();
diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h
index b6e0242..6d5c552 100644
--- a/cc/test/pixel_test.h
+++ b/cc/test/pixel_test.h
@@ -59,7 +59,7 @@ class PixelTest : public testing::Test, RendererClient {
void SetUpGLRenderer(bool use_skia_gpu_backend);
void SetUpSoftwareRenderer();
- void ForceExpandedViewport(gfx::Size surface_expansion);
+ void ForceExpandedViewport(const gfx::Size& surface_expansion);
void ForceViewportOffset(gfx::Vector2d viewport_offset);
void ForceDeviceClip(const gfx::Rect& clip);
void EnableExternalStencilTest();
diff --git a/cc/test/pixel_test_output_surface.cc b/cc/test/pixel_test_output_surface.cc
index e3f62bd..c773a52 100644
--- a/cc/test/pixel_test_output_surface.cc
+++ b/cc/test/pixel_test_output_surface.cc
@@ -17,7 +17,8 @@ PixelTestOutputSurface::PixelTestOutputSurface(
scoped_ptr<SoftwareOutputDevice> software_device)
: OutputSurface(software_device.Pass()), external_stencil_test_(false) {}
-void PixelTestOutputSurface::Reshape(gfx::Size size, float scale_factor) {
+void PixelTestOutputSurface::Reshape(const gfx::Size& size,
+ float scale_factor) {
gfx::Size expanded_size(size.width() + surface_expansion_size_.width(),
size.height() + surface_expansion_size_.height());
OutputSurface::Reshape(expanded_size, scale_factor);
diff --git a/cc/test/pixel_test_output_surface.h b/cc/test/pixel_test_output_surface.h
index 2a4573a..d3ec612 100644
--- a/cc/test/pixel_test_output_surface.h
+++ b/cc/test/pixel_test_output_surface.h
@@ -16,10 +16,10 @@ class PixelTestOutputSurface : public OutputSurface {
explicit PixelTestOutputSurface(
scoped_ptr<SoftwareOutputDevice> software_device);
- virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE;
+ virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE;
virtual bool HasExternalStencilTest() const OVERRIDE;
- void set_surface_expansion_size(gfx::Size surface_expansion_size) {
+ void set_surface_expansion_size(const gfx::Size& surface_expansion_size) {
surface_expansion_size_ = surface_expansion_size;
}
void set_has_external_stencil_test(bool has_test) {
diff --git a/cc/test/pixel_test_software_output_device.cc b/cc/test/pixel_test_software_output_device.cc
index d4f0b88..a8d986c 100644
--- a/cc/test/pixel_test_software_output_device.cc
+++ b/cc/test/pixel_test_software_output_device.cc
@@ -6,7 +6,7 @@
namespace cc {
-void PixelTestSoftwareOutputDevice::Resize(gfx::Size size) {
+void PixelTestSoftwareOutputDevice::Resize(const gfx::Size& size) {
gfx::Size expanded_size(size.width() + surface_expansion_size_.width(),
size.height() + surface_expansion_size_.height());
SoftwareOutputDevice::Resize(expanded_size);
diff --git a/cc/test/pixel_test_software_output_device.h b/cc/test/pixel_test_software_output_device.h
index b652063..7c1dae6 100644
--- a/cc/test/pixel_test_software_output_device.h
+++ b/cc/test/pixel_test_software_output_device.h
@@ -11,9 +11,9 @@ namespace cc {
class PixelTestSoftwareOutputDevice : public SoftwareOutputDevice {
public:
- virtual void Resize(gfx::Size size) OVERRIDE;
+ virtual void Resize(const gfx::Size& size) OVERRIDE;
- void set_surface_expansion_size(gfx::Size surface_expansion_size) {
+ void set_surface_expansion_size(const gfx::Size& surface_expansion_size) {
surface_expansion_size_ = surface_expansion_size;
}
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc
index dfccd64..277a124 100644
--- a/cc/test/skia_common.cc
+++ b/cc/test/skia_common.cc
@@ -25,7 +25,7 @@ void DrawPicture(unsigned char* buffer,
picture->Raster(&canvas, NULL, layer_rect, 1.0f);
}
-void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) {
+void CreateBitmap(const gfx::Size& size, const char* uri, SkBitmap* bitmap) {
SkImageInfo info = {
size.width(),
size.height(),
diff --git a/cc/test/skia_common.h b/cc/test/skia_common.h
index 3424799..3bafa0b 100644
--- a/cc/test/skia_common.h
+++ b/cc/test/skia_common.h
@@ -23,7 +23,7 @@ void DrawPicture(unsigned char* buffer,
const gfx::Rect& layer_rect,
scoped_refptr<Picture> picture);
-void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap);
+void CreateBitmap(const gfx::Size& size, const char* uri, SkBitmap* bitmap);
} // namespace cc
diff --git a/cc/test/test_texture.cc b/cc/test/test_texture.cc
index 0f4f07c..8addc79 100644
--- a/cc/test/test_texture.cc
+++ b/cc/test/test_texture.cc
@@ -9,7 +9,7 @@
namespace cc {
-size_t TextureSizeBytes(gfx::Size size, ResourceFormat format) {
+size_t TextureSizeBytes(const gfx::Size& size, ResourceFormat format) {
unsigned int components_per_pixel = 4;
unsigned int bytes_per_component = 1;
return size.width() * size.height() * components_per_pixel *
@@ -28,7 +28,7 @@ TestTexture::TestTexture() : format(RGBA_8888) {
TestTexture::~TestTexture() {}
-void TestTexture::Reallocate(gfx::Size size, ResourceFormat format) {
+void TestTexture::Reallocate(const gfx::Size& size, ResourceFormat format) {
this->size = size;
this->format = format;
this->data.reset(new uint8_t[TextureSizeBytes(size, format)]);
diff --git a/cc/test/test_texture.h b/cc/test/test_texture.h
index f5070e1..0e50bf0 100644
--- a/cc/test/test_texture.h
+++ b/cc/test/test_texture.h
@@ -14,12 +14,12 @@
namespace cc {
-size_t TextureSizeBytes(gfx::Size size, ResourceFormat format);
+size_t TextureSizeBytes(const gfx::Size& size, ResourceFormat format);
struct TestTexture : public base::RefCounted<TestTexture> {
TestTexture();
- void Reallocate(gfx::Size size, ResourceFormat format);
+ void Reallocate(const gfx::Size& size, ResourceFormat format);
bool IsValidParameter(GLenum pname);
gfx::Size size;
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index 6dddfd3..e39765e 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -35,7 +35,7 @@ FakeLayerUpdater::FakeLayerUpdater() : prepare_count_(0), update_count_(0) {}
FakeLayerUpdater::~FakeLayerUpdater() {}
void FakeLayerUpdater::PrepareToUpdate(const gfx::Rect& content_rect,
- gfx::Size tile_size,
+ const gfx::Size& tile_size,
float contents_width_scale,
float contents_height_scale,
gfx::Rect* resulting_opaque_rect) {
@@ -148,7 +148,7 @@ LayerUpdater* FakeTiledLayer::Updater() const {
}
void FakeTiledLayerWithScaledBounds::SetContentBounds(
- gfx::Size content_bounds) {
+ const gfx::Size& content_bounds) {
forced_content_bounds_ = content_bounds;
draw_properties().content_bounds = forced_content_bounds_;
}
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index 17de629..1e1aace 100644
--- a/cc/test/tiled_layer_test_common.h
+++ b/cc/test/tiled_layer_test_common.h
@@ -46,7 +46,7 @@ class FakeLayerUpdater : public LayerUpdater {
PrioritizedResourceManager* resource) OVERRIDE;
virtual void PrepareToUpdate(const gfx::Rect& content_rect,
- gfx::Size tile_size,
+ const gfx::Size& tile_size,
float contents_width_scale,
float contents_height_scale,
gfx::Rect* resulting_opaque_rect) OVERRIDE;
@@ -139,7 +139,7 @@ class FakeTiledLayerWithScaledBounds : public FakeTiledLayer {
explicit FakeTiledLayerWithScaledBounds(
PrioritizedResourceManager* resource_manager);
- void SetContentBounds(gfx::Size content_bounds);
+ void SetContentBounds(const gfx::Size& content_bounds);
virtual void CalculateContentsScale(float ideal_contents_scale,
float device_scale_factor,
float page_scale_factor,