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

Side by Side Diff: components/exo/compositor_frame_sink_holder.h

Issue 2584953002: exo::CompositorFrameSinkHolder's release callbacks hold ref (Closed)
Patch Set: Added ReleaseTextureAndCompositorFrameSinkHolder() and ReleaseContentsTextureAndCompositorFrameSink… 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ 5 #ifndef COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_
6 #define COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ 6 #define COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Overridden from SurfaceObserver: 72 // Overridden from SurfaceObserver:
73 void OnSurfaceDestroying(Surface* surface) override; 73 void OnSurfaceDestroying(Surface* surface) override;
74 74
75 private: 75 private:
76 friend class base::RefCounted<CompositorFrameSinkHolder>; 76 friend class base::RefCounted<CompositorFrameSinkHolder>;
77 77
78 ~CompositorFrameSinkHolder() override; 78 ~CompositorFrameSinkHolder() override;
79 79
80 void UpdateNeedsBeginFrame(); 80 void UpdateNeedsBeginFrame();
81 81
82 // Each release callback holds a reference to the CompositorFrameSinkHolder 82 // Each release callback should should take a
reveman 2016/12/22 17:00:53 Isn't this beyond the details of this class? If th
Alex Z. 2016/12/22 18:08:48 Done.
83 // itself to keep it alive. Running and erasing the callbacks might result in 83 // scoped_refptr<CompositorFrameSinkHolder> so that CompositorFrameSinkHolder
84 // the instance being destroyed. Therefore, we should not access any member 84 // lives at least until all callbacks are run. Running the
85 // variables after running and erasing the callbacks. 85 // callbacks might result in the instance being destroyed. Therefore, we
86 // should not access any member variables after running the callbacks.
86 using ResourceReleaseCallbackMap = 87 using ResourceReleaseCallbackMap =
87 std::map<int, 88 std::map<int, std::unique_ptr<cc::SingleReleaseCallback>>;
88 std::pair<scoped_refptr<CompositorFrameSinkHolder>,
89 std::unique_ptr<cc::SingleReleaseCallback>>>;
90 ResourceReleaseCallbackMap release_callbacks_; 89 ResourceReleaseCallbackMap release_callbacks_;
91 90
92 Surface* surface_; 91 Surface* surface_;
93 std::unique_ptr<CompositorFrameSink> frame_sink_; 92 std::unique_ptr<CompositorFrameSink> frame_sink_;
94 93
95 std::list<FrameCallback> active_frame_callbacks_; 94 std::list<FrameCallback> active_frame_callbacks_;
96 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; 95 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_;
97 bool needs_begin_frame_ = false; 96 bool needs_begin_frame_ = false;
98 cc::BeginFrameArgs last_begin_frame_args_; 97 cc::BeginFrameArgs last_begin_frame_args_;
99 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; 98 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
100 99
101 base::WeakPtrFactory<CompositorFrameSinkHolder> weak_factory_; 100 base::WeakPtrFactory<CompositorFrameSinkHolder> weak_factory_;
102 101
103 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder); 102 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder);
104 }; 103 };
105 104
106 } // namespace exo 105 } // namespace exo
107 106
108 #endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ 107 #endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698