| OLD | NEW |
| 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 Loading... |
| 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 // A collection of callbacks used to release resources. |
| 83 // itself to keep it alive. Running and erasing the callbacks might result in | |
| 84 // the instance being destroyed. Therefore, we should not access any member | |
| 85 // variables after running and erasing the callbacks. | |
| 86 using ResourceReleaseCallbackMap = | 83 using ResourceReleaseCallbackMap = |
| 87 std::map<int, | 84 std::map<int, std::unique_ptr<cc::SingleReleaseCallback>>; |
| 88 std::pair<scoped_refptr<CompositorFrameSinkHolder>, | |
| 89 std::unique_ptr<cc::SingleReleaseCallback>>>; | |
| 90 ResourceReleaseCallbackMap release_callbacks_; | 85 ResourceReleaseCallbackMap release_callbacks_; |
| 91 | 86 |
| 92 Surface* surface_; | 87 Surface* surface_; |
| 93 std::unique_ptr<CompositorFrameSink> frame_sink_; | 88 std::unique_ptr<CompositorFrameSink> frame_sink_; |
| 94 | 89 |
| 95 std::list<FrameCallback> active_frame_callbacks_; | 90 std::list<FrameCallback> active_frame_callbacks_; |
| 96 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | 91 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
| 97 bool needs_begin_frame_ = false; | 92 bool needs_begin_frame_ = false; |
| 98 cc::BeginFrameArgs last_begin_frame_args_; | 93 cc::BeginFrameArgs last_begin_frame_args_; |
| 99 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; | 94 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; |
| 100 | 95 |
| 101 base::WeakPtrFactory<CompositorFrameSinkHolder> weak_factory_; | 96 base::WeakPtrFactory<CompositorFrameSinkHolder> weak_factory_; |
| 102 | 97 |
| 103 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder); | 98 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder); |
| 104 }; | 99 }; |
| 105 | 100 |
| 106 } // namespace exo | 101 } // namespace exo |
| 107 | 102 |
| 108 #endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ | 103 #endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ |
| OLD | NEW |