diff options
author | vmpstr <vmpstr@chromium.org> | 2016-03-16 13:44:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-16 20:46:15 +0000 |
commit | 4065174ac28746b10a832411426bd756d9c5979c (patch) | |
tree | 9ea7bf51f94a7b35b1921187fc8b93c48df9077e /cc/output | |
parent | e886edbb2d3d7eade99d9542b56dfc9a7701248f (diff) | |
download | chromium_src-4065174ac28746b10a832411426bd756d9c5979c.zip chromium_src-4065174ac28746b10a832411426bd756d9c5979c.tar.gz chromium_src-4065174ac28746b10a832411426bd756d9c5979c.tar.bz2 |
cc: Remove some unnecessary const scoped_refptr&.
This patch makes the API a bit clearer by taking a copy of scoped_refptr
in some situations (where ownership is shared) and using a raw pointer
in situations where ownership is not needed. The only references that
remain are the ones captured in lambdas or Callbacks.
R=danakj
BUG=589044
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1803863003
Cr-Commit-Position: refs/heads/master@{#381524}
Diffstat (limited to 'cc/output')
-rw-r--r-- | cc/output/output_surface.cc | 32 | ||||
-rw-r--r-- | cc/output/output_surface.h | 13 | ||||
-rw-r--r-- | cc/output/renderer_pixeltest.cc | 4 | ||||
-rw-r--r-- | cc/output/renderer_unittest.cc | 8 | ||||
-rw-r--r-- | cc/output/texture_mailbox_deleter.cc | 17 | ||||
-rw-r--r-- | cc/output/texture_mailbox_deleter.h | 4 |
6 files changed, 37 insertions, 41 deletions
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 85372ce..5698635 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -119,12 +119,12 @@ class SkiaGpuTraceMemoryDump : public SkTraceMemoryDump { } // namespace OutputSurface::OutputSurface( - const scoped_refptr<ContextProvider>& context_provider, - const scoped_refptr<ContextProvider>& worker_context_provider, + scoped_refptr<ContextProvider> context_provider, + scoped_refptr<ContextProvider> worker_context_provider, scoped_ptr<SoftwareOutputDevice> software_device) : client_(NULL), - context_provider_(context_provider), - worker_context_provider_(worker_context_provider), + context_provider_(std::move(context_provider)), + worker_context_provider_(std::move(worker_context_provider)), software_device_(std::move(software_device)), device_scale_factor_(-1), has_alpha_(true), @@ -133,24 +133,24 @@ OutputSurface::OutputSurface( client_thread_checker_.DetachFromThread(); } -OutputSurface::OutputSurface( - const scoped_refptr<ContextProvider>& context_provider) - : OutputSurface(context_provider, nullptr, nullptr) { -} +OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider) + : OutputSurface(std::move(context_provider), nullptr, nullptr) {} OutputSurface::OutputSurface( - const scoped_refptr<ContextProvider>& context_provider, - const scoped_refptr<ContextProvider>& worker_context_provider) - : OutputSurface(context_provider, worker_context_provider, nullptr) { -} + scoped_refptr<ContextProvider> context_provider, + scoped_refptr<ContextProvider> worker_context_provider) + : OutputSurface(std::move(context_provider), + std::move(worker_context_provider), + nullptr) {} OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device) : OutputSurface(nullptr, nullptr, std::move(software_device)) {} -OutputSurface::OutputSurface( - const scoped_refptr<ContextProvider>& context_provider, - scoped_ptr<SoftwareOutputDevice> software_device) - : OutputSurface(context_provider, nullptr, std::move(software_device)) {} +OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider, + scoped_ptr<SoftwareOutputDevice> software_device) + : OutputSurface(std::move(context_provider), + nullptr, + std::move(software_device)) {} void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval) { diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index 04a105c..64cb19e 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -45,17 +45,16 @@ class OutputSurfaceClient; // surface (on the compositor thread) and go back to step 1. class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { public: - OutputSurface(const scoped_refptr<ContextProvider>& context_provider, - const scoped_refptr<ContextProvider>& worker_context_provider, + OutputSurface(scoped_refptr<ContextProvider> context_provider, + scoped_refptr<ContextProvider> worker_context_provider, scoped_ptr<SoftwareOutputDevice> software_device); - OutputSurface(const scoped_refptr<ContextProvider>& context_provider, - const scoped_refptr<ContextProvider>& worker_context_provider); - explicit OutputSurface( - const scoped_refptr<ContextProvider>& context_provider); + OutputSurface(scoped_refptr<ContextProvider> context_provider, + scoped_refptr<ContextProvider> worker_context_provider); + explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); - OutputSurface(const scoped_refptr<ContextProvider>& context_provider, + OutputSurface(scoped_refptr<ContextProvider> context_provider, scoped_ptr<SoftwareOutputDevice> software_device); ~OutputSurface() override; diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 7f5bbfd..a953a92 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -272,7 +272,7 @@ void CreateTestYUVVideoDrawQuad_FromVideoFrame( // Upshift video frame to 10 bit. scoped_refptr<media::VideoFrame> CreateHighbitVideoFrame( - const scoped_refptr<media::VideoFrame>& video_frame) { + media::VideoFrame* video_frame) { media::VideoPixelFormat format; switch (video_frame->format()) { case media::PIXEL_FORMAT_I420: @@ -358,7 +358,7 @@ void CreateTestYUVVideoDrawQuad_Striped( uint8_t alpha_value = is_transparent ? 0 : 128; if (highbit) - video_frame = CreateHighbitVideoFrame(video_frame); + video_frame = CreateHighbitVideoFrame(video_frame.get()); CreateTestYUVVideoDrawQuad_FromVideoFrame( shared_state, video_frame, alpha_value, tex_coord_rect, render_pass, diff --git a/cc/output/renderer_unittest.cc b/cc/output/renderer_unittest.cc index 3c8b0b8..1648aec 100644 --- a/cc/output/renderer_unittest.cc +++ b/cc/output/renderer_unittest.cc @@ -18,8 +18,7 @@ namespace { class TestOutputSurface : public OutputSurface { public: - explicit TestOutputSurface( - const scoped_refptr<ContextProvider>& context_provider); + explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider); ~TestOutputSurface() override; // OutputSurface implementation @@ -27,9 +26,8 @@ class TestOutputSurface : public OutputSurface { }; TestOutputSurface::TestOutputSurface( - const scoped_refptr<ContextProvider>& context_provider) - : OutputSurface(context_provider) { -} + scoped_refptr<ContextProvider> context_provider) + : OutputSurface(std::move(context_provider)) {} TestOutputSurface::~TestOutputSurface() { } diff --git a/cc/output/texture_mailbox_deleter.cc b/cc/output/texture_mailbox_deleter.cc index 2bef8eb..1310fe7 100644 --- a/cc/output/texture_mailbox_deleter.cc +++ b/cc/output/texture_mailbox_deleter.cc @@ -40,8 +40,8 @@ static void PostTaskFromMainToImplThread( } TextureMailboxDeleter::TextureMailboxDeleter( - const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) - : impl_task_runner_(task_runner), weak_ptr_factory_(this) {} + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : impl_task_runner_(std::move(task_runner)), weak_ptr_factory_(this) {} TextureMailboxDeleter::~TextureMailboxDeleter() { for (size_t i = 0; i < impl_callbacks_.size(); ++i) @@ -49,15 +49,14 @@ TextureMailboxDeleter::~TextureMailboxDeleter() { } scoped_ptr<SingleReleaseCallback> TextureMailboxDeleter::GetReleaseCallback( - const scoped_refptr<ContextProvider>& context_provider, + scoped_refptr<ContextProvider> context_provider, unsigned texture_id) { - // This callback owns a reference on the |context_provider|. It must be - // destroyed on the impl thread. Upon destruction of this class, the - // callback must immediately be destroyed. + // This callback owns the |context_provider|. It must be destroyed on the impl + // thread. Upon destruction of this class, the callback must immediately be + // destroyed. scoped_ptr<SingleReleaseCallback> impl_callback = - SingleReleaseCallback::Create(base::Bind(&DeleteTextureOnImplThread, - context_provider, - texture_id)); + SingleReleaseCallback::Create(base::Bind( + &DeleteTextureOnImplThread, std::move(context_provider), texture_id)); impl_callbacks_.push_back(std::move(impl_callback)); diff --git a/cc/output/texture_mailbox_deleter.h b/cc/output/texture_mailbox_deleter.h index 051ad34..f25661d 100644 --- a/cc/output/texture_mailbox_deleter.h +++ b/cc/output/texture_mailbox_deleter.h @@ -27,7 +27,7 @@ class CC_EXPORT TextureMailboxDeleter { // task_runner corresponds with the thread the delete task should be posted // to. If null, the delete will happen on the calling thread. explicit TextureMailboxDeleter( - const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); + scoped_refptr<base::SingleThreadTaskRunner> task_runner); ~TextureMailboxDeleter(); // Returns a Callback that can be used as the ReleaseCallback for a @@ -38,7 +38,7 @@ class CC_EXPORT TextureMailboxDeleter { // become a no-op and the texture will be deleted immediately on the // impl thread, along with dropping the reference to the ContextProvider. scoped_ptr<SingleReleaseCallback> GetReleaseCallback( - const scoped_refptr<ContextProvider>& context_provider, + scoped_refptr<ContextProvider> context_provider, unsigned texture_id); private: |