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

Unified Diff: components/exo/compositor_frame_sink_holder.h

Issue 2584953002: exo::CompositorFrameSinkHolder's release callbacks hold ref (Closed)
Patch Set: Addressed comments 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.h
diff --git a/components/exo/compositor_frame_sink_holder.h b/components/exo/compositor_frame_sink_holder.h
index 59cc9879e8908be5adeeae3adf1a92fa5b83bd4c..d2f8ab8f3a3ed38354c8ded99e2d6230a4b4acc4 100644
--- a/components/exo/compositor_frame_sink_holder.h
+++ b/components/exo/compositor_frame_sink_holder.h
@@ -10,7 +10,7 @@
#include <memory>
#include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
-#include "cc/resources/single_release_callback.h"
+#include "cc/resources/release_callback.h"
#include "cc/resources/transferable_resource.h"
#include "cc/scheduler/begin_frame_source.h"
#include "components/exo/compositor_frame_sink.h"
@@ -37,9 +37,8 @@ class CompositorFrameSinkHolder
cc::mojom::MojoCompositorFrameSinkClientRequest request);
bool HasReleaseCallbackForResource(cc::ResourceId id);
- void AddResourceReleaseCallback(
- cc::ResourceId id,
- std::unique_ptr<cc::SingleReleaseCallback> callback);
+ void SetResourceReleaseCallback(cc::ResourceId id,
+ const cc::ReleaseCallback& callback);
CompositorFrameSink* GetCompositorFrameSink() { return frame_sink_.get(); }
@@ -79,14 +78,8 @@ class CompositorFrameSinkHolder
void UpdateNeedsBeginFrame();
- // Each release callback holds a reference to the CompositorFrameSinkHolder
- // itself to keep it alive. Running and erasing the callbacks might result in
- // the instance being destroyed. Therefore, we should not access any member
- // variables after running and erasing the callbacks.
- using ResourceReleaseCallbackMap =
- std::map<int,
- std::pair<scoped_refptr<CompositorFrameSinkHolder>,
- std::unique_ptr<cc::SingleReleaseCallback>>>;
+ // A collection of callbacks used to release resources.
+ using ResourceReleaseCallbackMap = std::map<int, cc::ReleaseCallback>;
ResourceReleaseCallbackMap release_callbacks_;
Surface* surface_;

Powered by Google App Engine
This is Rietveld 408576698