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

Unified Diff: components/exo/compositor_frame_sink_holder.cc

Issue 2584953002: exo::CompositorFrameSinkHolder's release callbacks hold ref (Closed)
Patch Set: Removed unrelated changes Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/compositor_frame_sink_holder.cc
diff --git a/components/exo/compositor_frame_sink_holder.cc b/components/exo/compositor_frame_sink_holder.cc
index dd82aff4dc1dc915afc79434ccbb091dc0c6d476..aef99e6f759de4d909e2fb891bed1f0bd22a07b2 100644
--- a/components/exo/compositor_frame_sink_holder.cc
+++ b/components/exo/compositor_frame_sink_holder.cc
@@ -9,6 +9,14 @@
namespace exo {
+namespace {
+void RunSingleReleaseCallback(cc::SingleReleaseCallback* callback,
reveman 2016/12/20 16:34:28 Can you bind cc::SingleReleaseCallback::Run direct
Alex Z. 2016/12/20 17:54:01 This wrapper is now needed for holding a reference
+ const gpu::SyncToken& sync_token,
+ bool is_lost) {
+ callback->Run(sync_token, is_lost);
+}
+} // namespace
+
////////////////////////////////////////////////////////////////////////////////
// CompositorFrameSinkHolder, public:
@@ -80,13 +88,16 @@ void CompositorFrameSinkHolder::OnBeginFrame(const cc::BeginFrameArgs& args) {
void CompositorFrameSinkHolder::ReclaimResources(
const cc::ReturnedResourceArray& resources) {
+ scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder;
reveman 2016/12/20 16:34:28 This shouldn't be needed anymore, right?
Alex Z. 2016/12/20 17:54:01 CompositorFrameSinkHolder still gets destroyed too
for (auto& resource : resources) {
auto it = release_callbacks_.find(resource.id);
DCHECK(it != release_callbacks_.end());
- std::unique_ptr<cc::SingleReleaseCallback> callback =
- std::move(it->second.second);
+ compositor_frame_sink_holder = std::move(it->second.first);
+ auto closure =
reveman 2016/12/20 16:34:28 nit: no need for this temporary variable. pass the
Alex Z. 2016/12/20 17:54:01 Done.
+ base::Bind(&RunSingleReleaseCallback, it->second.second.get(),
reveman 2016/12/20 16:34:28 it->second.second.get() shouldn't work. The callba
+ resource.sync_token, resource.lost);
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure);
reveman 2016/12/20 16:34:28 What if the message loop is shutdown before this g
Alex Z. 2016/12/20 17:54:01 It seems no matter how we invoke the Callback::Run
release_callbacks_.erase(it);
- callback->Run(resource.sync_token, resource.lost);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698