diff options
author | prashant.n@samsung.com <prashant.n@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-28 06:37:17 +0000 |
---|---|---|
committer | prashant.n@samsung.com <prashant.n@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-28 06:37:17 +0000 |
commit | c93cbb62f684183e0e5689a9fa35619daac10f7b (patch) | |
tree | 8002e049a31ad5cad79f63d19fe1f79b68b8ae2f /cc/output | |
parent | 22a9610ffaed4d7690463d2f6f710d46c206c70f (diff) | |
download | chromium_src-c93cbb62f684183e0e5689a9fa35619daac10f7b.zip chromium_src-c93cbb62f684183e0e5689a9fa35619daac10f7b.tar.gz chromium_src-c93cbb62f684183e0e5689a9fa35619daac10f7b.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
Review URL: https://codereview.chromium.org/145313006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247426 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output')
-rw-r--r-- | cc/output/copy_output_request.cc | 2 | ||||
-rw-r--r-- | cc/output/copy_output_request.h | 2 | ||||
-rw-r--r-- | cc/output/copy_output_result.cc | 2 | ||||
-rw-r--r-- | cc/output/copy_output_result.h | 4 | ||||
-rw-r--r-- | cc/output/direct_renderer.cc | 2 | ||||
-rw-r--r-- | cc/output/direct_renderer.h | 2 | ||||
-rw-r--r-- | cc/output/gl_renderer.cc | 2 | ||||
-rw-r--r-- | cc/output/gl_renderer.h | 2 | ||||
-rw-r--r-- | cc/output/gl_renderer_unittest.cc | 6 | ||||
-rw-r--r-- | cc/output/output_surface.cc | 2 | ||||
-rw-r--r-- | cc/output/output_surface.h | 2 | ||||
-rw-r--r-- | cc/output/shader.cc | 2 | ||||
-rw-r--r-- | cc/output/shader.h | 2 | ||||
-rw-r--r-- | cc/output/software_output_device.cc | 2 | ||||
-rw-r--r-- | cc/output/software_output_device.h | 2 |
15 files changed, 18 insertions, 18 deletions
diff --git a/cc/output/copy_output_request.cc b/cc/output/copy_output_request.cc index 50173d5..56dac2a 100644 --- a/cc/output/copy_output_request.cc +++ b/cc/output/copy_output_request.cc @@ -55,7 +55,7 @@ void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) { } void CopyOutputRequest::SendTextureResult( - gfx::Size size, + const gfx::Size& size, const TextureMailbox& texture_mailbox, scoped_ptr<SingleReleaseCallback> release_callback) { DCHECK(texture_mailbox.IsTexture()); diff --git a/cc/output/copy_output_request.h b/cc/output/copy_output_request.h index 6d8870d..dcb2fe2 100644 --- a/cc/output/copy_output_request.h +++ b/cc/output/copy_output_request.h @@ -62,7 +62,7 @@ class CC_EXPORT CopyOutputRequest { void SendEmptyResult(); void SendBitmapResult(scoped_ptr<SkBitmap> bitmap); - void SendTextureResult(gfx::Size size, + void SendTextureResult(const gfx::Size& size, const TextureMailbox& texture_mailbox, scoped_ptr<SingleReleaseCallback> release_callback); diff --git a/cc/output/copy_output_result.cc b/cc/output/copy_output_result.cc index 1831fba..adbb8de 100644 --- a/cc/output/copy_output_result.cc +++ b/cc/output/copy_output_result.cc @@ -20,7 +20,7 @@ CopyOutputResult::CopyOutputResult(scoped_ptr<SkBitmap> bitmap) } CopyOutputResult::CopyOutputResult( - gfx::Size size, + const gfx::Size& size, const TextureMailbox& texture_mailbox, scoped_ptr<SingleReleaseCallback> release_callback) : size_(size), diff --git a/cc/output/copy_output_result.h b/cc/output/copy_output_result.h index c2f011d..b4806581 100644 --- a/cc/output/copy_output_result.h +++ b/cc/output/copy_output_result.h @@ -26,7 +26,7 @@ class CC_EXPORT CopyOutputResult { return make_scoped_ptr(new CopyOutputResult(bitmap.Pass())); } static scoped_ptr<CopyOutputResult> CreateTextureResult( - gfx::Size size, + const gfx::Size& size, const TextureMailbox& texture_mailbox, scoped_ptr<SingleReleaseCallback> release_callback) { return make_scoped_ptr( @@ -47,7 +47,7 @@ class CC_EXPORT CopyOutputResult { private: CopyOutputResult(); explicit CopyOutputResult(scoped_ptr<SkBitmap> bitmap); - explicit CopyOutputResult(gfx::Size size, + explicit CopyOutputResult(const gfx::Size& size, const TextureMailbox& texture_mailbox, scoped_ptr<SingleReleaseCallback> release_callback); diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc index f90789d..06e2afb 100644 --- a/cc/output/direct_renderer.cc +++ b/cc/output/direct_renderer.cc @@ -83,7 +83,7 @@ void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, void DirectRenderer::InitializeViewport(DrawingFrame* frame, const gfx::Rect& draw_rect, const gfx::Rect& viewport_rect, - gfx::Size surface_size) { + const gfx::Size& surface_size) { bool flip_y = FlippedFramebuffer(); DCHECK_GE(viewport_rect.x(), 0); diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h index 4a447aa..08b75a1 100644 --- a/cc/output/direct_renderer.h +++ b/cc/output/direct_renderer.h @@ -74,7 +74,7 @@ class CC_EXPORT DirectRenderer : public Renderer { void InitializeViewport(DrawingFrame* frame, const gfx::Rect& draw_rect, const gfx::Rect& viewport_rect, - gfx::Size surface_size); + const gfx::Size& surface_size); gfx::Rect MoveFromDrawToWindowSpace(const gfx::RectF& draw_rect) const; bool NeedDeviceClip(const DrawingFrame* frame) const; diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 028c409..f2a3b15 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -2402,7 +2402,7 @@ void GLRenderer::FinishedReadback( unsigned source_buffer, unsigned query, uint8* dest_pixels, - gfx::Size size) { + const gfx::Size& size) { DCHECK(!pending_async_read_pixels_.empty()); if (query != 0) { diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index 5feecd4..82befc7 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -208,7 +208,7 @@ class CC_EXPORT GLRenderer : public DirectRenderer { unsigned source_buffer, unsigned query, uint8_t* dest_pixels, - gfx::Size size); + const gfx::Size& size); void PassOnSkBitmap(scoped_ptr<SkBitmap> bitmap, scoped_ptr<SkAutoLockPixels> lock, scoped_ptr<CopyOutputRequest> request, diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index f7bb3bd..476f7a8 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -1059,8 +1059,8 @@ class NonReshapableOutputSurface : public FakeOutputSurface { false) { surface_size_ = gfx::Size(500, 500); } - virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE {} - void set_fixed_size(gfx::Size size) { surface_size_ = size; } + virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE {} + void set_fixed_size(const gfx::Size& size) { surface_size_ = size; } }; TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { @@ -1674,7 +1674,7 @@ class MockOutputSurface : public OutputSurface { MOCK_METHOD0(EnsureBackbuffer, void()); MOCK_METHOD0(DiscardBackbuffer, void()); - MOCK_METHOD2(Reshape, void(gfx::Size size, float scale_factor)); + MOCK_METHOD2(Reshape, void(const gfx::Size& size, float scale_factor)); MOCK_METHOD0(BindFramebuffer, void()); MOCK_METHOD1(SwapBuffers, void(CompositorFrame* frame)); }; diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index f3952d5..9ba6dbb 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -355,7 +355,7 @@ void OutputSurface::DiscardBackbuffer() { software_device_->DiscardBackbuffer(); } -void OutputSurface::Reshape(gfx::Size size, float scale_factor) { +void OutputSurface::Reshape(const gfx::Size& size, float scale_factor) { if (size == surface_size_ && scale_factor == device_scale_factor_) return; diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index aae3b8c..754707b 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -114,7 +114,7 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { virtual void EnsureBackbuffer(); virtual void DiscardBackbuffer(); - virtual void Reshape(gfx::Size size, float scale_factor); + virtual void Reshape(const gfx::Size& size, float scale_factor); virtual gfx::Size SurfaceSize() const; virtual void BindFramebuffer(); diff --git a/cc/output/shader.cc b/cc/output/shader.cc index b752f46..1c7040e 100644 --- a/cc/output/shader.cc +++ b/cc/output/shader.cc @@ -146,7 +146,7 @@ TexCoordPrecision TexCoordPrecisionRequired(GLES2Interface* context, TexCoordPrecision TexCoordPrecisionRequired(GLES2Interface* context, int *highp_threshold_cache, int highp_threshold_min, - gfx::Size max_size) { + const gfx::Size& max_size) { return TexCoordPrecisionRequired(context, highp_threshold_cache, highp_threshold_min, max_size.width(), max_size.height()); diff --git a/cc/output/shader.h b/cc/output/shader.h index 9473ce8..8b2a5d9 100644 --- a/cc/output/shader.h +++ b/cc/output/shader.h @@ -53,7 +53,7 @@ CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( gpu::gles2::GLES2Interface* context, int *highp_threshold_cache, int highp_threshold_min, - gfx::Size max_size); + const gfx::Size& max_size); class VertexShaderPosTex { public: diff --git a/cc/output/software_output_device.cc b/cc/output/software_output_device.cc index 3e75e06..9730f7d 100644 --- a/cc/output/software_output_device.cc +++ b/cc/output/software_output_device.cc @@ -17,7 +17,7 @@ SoftwareOutputDevice::SoftwareOutputDevice() {} SoftwareOutputDevice::~SoftwareOutputDevice() {} -void SoftwareOutputDevice::Resize(gfx::Size viewport_size) { +void SoftwareOutputDevice::Resize(const gfx::Size& viewport_size) { if (viewport_size_ == viewport_size) return; diff --git a/cc/output/software_output_device.h b/cc/output/software_output_device.h index e203902..827210e 100644 --- a/cc/output/software_output_device.h +++ b/cc/output/software_output_device.h @@ -36,7 +36,7 @@ class CC_EXPORT SoftwareOutputDevice { // Discards any pre-existing backing buffers and allocates memory for a // software device of |size|. This must be called before the // |SoftwareOutputDevice| can be used in other ways. - virtual void Resize(gfx::Size size); + virtual void Resize(const gfx::Size& size); // Called on BeginDrawingFrame. The compositor will draw into the returned // SkCanvas. The |SoftwareOutputDevice| implementation needs to provide a |