Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: cc/output/texture_mailbox_deleter.cc

Issue 1803863003: cc: Remove some unnecessary const scoped_refptr&. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/texture_mailbox_deleter.h ('k') | cc/resources/video_resource_updater.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/texture_mailbox_deleter.h" 5 #include "cc/output/texture_mailbox_deleter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 22 matching lines...) Expand all
33 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 33 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
34 ReleaseCallback run_impl_callback, 34 ReleaseCallback run_impl_callback,
35 const gpu::SyncToken& sync_token, 35 const gpu::SyncToken& sync_token,
36 bool is_lost) { 36 bool is_lost) {
37 // This posts the task to RunDeleteTextureOnImplThread(). 37 // This posts the task to RunDeleteTextureOnImplThread().
38 impl_task_runner->PostTask( 38 impl_task_runner->PostTask(
39 FROM_HERE, base::Bind(run_impl_callback, sync_token, is_lost)); 39 FROM_HERE, base::Bind(run_impl_callback, sync_token, is_lost));
40 } 40 }
41 41
42 TextureMailboxDeleter::TextureMailboxDeleter( 42 TextureMailboxDeleter::TextureMailboxDeleter(
43 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 43 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
44 : impl_task_runner_(task_runner), weak_ptr_factory_(this) {} 44 : impl_task_runner_(std::move(task_runner)), weak_ptr_factory_(this) {}
45 45
46 TextureMailboxDeleter::~TextureMailboxDeleter() { 46 TextureMailboxDeleter::~TextureMailboxDeleter() {
47 for (size_t i = 0; i < impl_callbacks_.size(); ++i) 47 for (size_t i = 0; i < impl_callbacks_.size(); ++i)
48 impl_callbacks_.at(i)->Run(gpu::SyncToken(), true); 48 impl_callbacks_.at(i)->Run(gpu::SyncToken(), true);
49 } 49 }
50 50
51 scoped_ptr<SingleReleaseCallback> TextureMailboxDeleter::GetReleaseCallback( 51 scoped_ptr<SingleReleaseCallback> TextureMailboxDeleter::GetReleaseCallback(
52 const scoped_refptr<ContextProvider>& context_provider, 52 scoped_refptr<ContextProvider> context_provider,
53 unsigned texture_id) { 53 unsigned texture_id) {
54 // This callback owns a reference on the |context_provider|. It must be 54 // This callback owns the |context_provider|. It must be destroyed on the impl
55 // destroyed on the impl thread. Upon destruction of this class, the 55 // thread. Upon destruction of this class, the callback must immediately be
56 // callback must immediately be destroyed. 56 // destroyed.
57 scoped_ptr<SingleReleaseCallback> impl_callback = 57 scoped_ptr<SingleReleaseCallback> impl_callback =
58 SingleReleaseCallback::Create(base::Bind(&DeleteTextureOnImplThread, 58 SingleReleaseCallback::Create(base::Bind(
59 context_provider, 59 &DeleteTextureOnImplThread, std::move(context_provider), texture_id));
60 texture_id));
61 60
62 impl_callbacks_.push_back(std::move(impl_callback)); 61 impl_callbacks_.push_back(std::move(impl_callback));
63 62
64 // The raw pointer to the impl-side callback is valid as long as this 63 // The raw pointer to the impl-side callback is valid as long as this
65 // class is alive. So we guard it with a WeakPtr. 64 // class is alive. So we guard it with a WeakPtr.
66 ReleaseCallback run_impl_callback( 65 ReleaseCallback run_impl_callback(
67 base::Bind(&TextureMailboxDeleter::RunDeleteTextureOnImplThread, 66 base::Bind(&TextureMailboxDeleter::RunDeleteTextureOnImplThread,
68 weak_ptr_factory_.GetWeakPtr(), impl_callbacks_.back().get())); 67 weak_ptr_factory_.GetWeakPtr(), impl_callbacks_.back().get()));
69 68
70 // Provide a callback for the main thread that posts back to the impl 69 // Provide a callback for the main thread that posts back to the impl
(...skipping 20 matching lines...) Expand all
91 impl_callbacks_.erase(impl_callbacks_.begin() + i); 90 impl_callbacks_.erase(impl_callbacks_.begin() + i);
92 return; 91 return;
93 } 92 }
94 } 93 }
95 94
96 NOTREACHED() << "The Callback returned by GetDeleteCallback() was called " 95 NOTREACHED() << "The Callback returned by GetDeleteCallback() was called "
97 << "more than once."; 96 << "more than once.";
98 } 97 }
99 98
100 } // namespace cc 99 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/texture_mailbox_deleter.h ('k') | cc/resources/video_resource_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698