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

Unified Diff: components/exo/compositor_frame_sink_holder.h

Issue 2584953002: exo::CompositorFrameSinkHolder's release callbacks hold ref (Closed)
Patch Set: All exo unit tests passed. 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..3af9c3d3b83f5fe73fe910c3644926bafff404a3 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(); }
@@ -72,21 +71,16 @@ class CompositorFrameSinkHolder
// Overridden from SurfaceObserver:
void OnSurfaceDestroying(Surface* surface) override;
+ protected:
+ ~CompositorFrameSinkHolder() override;
reveman 2017/01/03 23:24:47 why change this?
Alex Z. 2017/01/03 23:39:15 This was for the MockCompositorFrameSinkHolder. I'
+
private:
friend class base::RefCounted<CompositorFrameSinkHolder>;
- ~CompositorFrameSinkHolder() override;
-
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