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

Unified Diff: components/exo/compositor_frame_sink_holder.cc

Issue 2584953002: exo::CompositorFrameSinkHolder's release callbacks hold ref (Closed)
Patch Set: NOT FOR COMMIT: Buffer references sink_holder Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
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 dcd3110ab6ea9cb7a03a31a22d1e5b44cb906787..112b02530f3d89b6b903dc9200f128f06944fd16 100644
--- a/components/exo/compositor_frame_sink_holder.cc
+++ b/components/exo/compositor_frame_sink_holder.cc
@@ -4,7 +4,6 @@
#include "components/exo/compositor_frame_sink_holder.h"
-#include "base/memory/ptr_util.h"
#include "cc/resources/returned_resource.h"
#include "components/exo/surface.h"
@@ -33,7 +32,7 @@ bool CompositorFrameSinkHolder::HasReleaseCallbackForResource(
void CompositorFrameSinkHolder::AddResourceReleaseCallback(
reveman 2017/01/02 19:57:56 nit: SetResourceReleaseCallback
cc::ResourceId id,
std::unique_ptr<cc::SingleReleaseCallback> callback) {
- release_callbacks_[id] = std::make_pair(this, std::move(callback));
+ release_callbacks_[id] = std::move(callback);
}
void CompositorFrameSinkHolder::ActivateFrameCallbacks(
@@ -84,10 +83,12 @@ void CompositorFrameSinkHolder::ReclaimResources(
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);
+ bool will_run = base::ThreadTaskRunnerHandle::Get()->PostTask(
reveman 2017/01/02 19:57:56 If you remove the reset of the sink holder in Buff
+ FROM_HERE, base::Bind(&cc::SingleReleaseCallback::Run,
+ base::Passed(std::move(it->second)),
+ resource.sync_token, resource.lost));
+ DCHECK(will_run);
release_callbacks_.erase(it);
- callback->Run(resource.sync_token, resource.lost);
}
}

Powered by Google App Engine
This is Rietveld 408576698