| 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 13 matching lines...) Expand all Loading... |
| 24 // the contents of Buffers. It's keeped alive by references from | 24 // the contents of Buffers. It's keeped alive by references from |
| 25 // release_callbacks_. It's destroyed when its owning Surface is destroyed and | 25 // release_callbacks_. It's destroyed when its owning Surface is destroyed and |
| 26 // the last outstanding release callback is called. | 26 // the last outstanding release callback is called. |
| 27 class CompositorFrameSinkHolder | 27 class CompositorFrameSinkHolder |
| 28 : public base::RefCounted<CompositorFrameSinkHolder>, | 28 : public base::RefCounted<CompositorFrameSinkHolder>, |
| 29 public cc::ExternalBeginFrameSourceClient, | 29 public cc::ExternalBeginFrameSourceClient, |
| 30 public cc::mojom::MojoCompositorFrameSinkClient, | 30 public cc::mojom::MojoCompositorFrameSinkClient, |
| 31 public cc::BeginFrameObserver, | 31 public cc::BeginFrameObserver, |
| 32 public SurfaceObserver { | 32 public SurfaceObserver { |
| 33 public: | 33 public: |
| 34 CompositorFrameSinkHolder( | 34 CompositorFrameSinkHolder(Surface* surface, |
| 35 Surface* surface, | 35 const cc::FrameSinkId& frame_sink_id, |
| 36 std::unique_ptr<CompositorFrameSink> frame_sink, | 36 cc::SurfaceManager* surface_manager); |
| 37 cc::mojom::MojoCompositorFrameSinkClientRequest request); | |
| 38 | 37 |
| 39 bool HasReleaseCallbackForResource(cc::ResourceId id); | 38 bool HasReleaseCallbackForResource(cc::ResourceId id); |
| 40 void SetResourceReleaseCallback(cc::ResourceId id, | 39 void SetResourceReleaseCallback(cc::ResourceId id, |
| 41 const cc::ReleaseCallback& callback); | 40 const cc::ReleaseCallback& callback); |
| 42 | 41 |
| 43 CompositorFrameSink* GetCompositorFrameSink() { return frame_sink_.get(); } | 42 CompositorFrameSink* GetCompositorFrameSink() { return frame_sink_.get(); } |
| 44 | 43 |
| 45 base::WeakPtr<CompositorFrameSinkHolder> GetWeakPtr() { | 44 base::WeakPtr<CompositorFrameSinkHolder> GetWeakPtr() { |
| 46 return weak_factory_.GetWeakPtr(); | 45 return weak_factory_.GetWeakPtr(); |
| 47 } | 46 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 77 // A collection of callbacks used to release resources. | 76 // A collection of callbacks used to release resources. |
| 78 using ResourceReleaseCallbackMap = std::map<int, cc::ReleaseCallback>; | 77 using ResourceReleaseCallbackMap = std::map<int, cc::ReleaseCallback>; |
| 79 ResourceReleaseCallbackMap release_callbacks_; | 78 ResourceReleaseCallbackMap release_callbacks_; |
| 80 | 79 |
| 81 Surface* surface_; | 80 Surface* surface_; |
| 82 std::unique_ptr<CompositorFrameSink> frame_sink_; | 81 std::unique_ptr<CompositorFrameSink> frame_sink_; |
| 83 | 82 |
| 84 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | 83 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
| 85 bool needs_begin_frame_ = false; | 84 bool needs_begin_frame_ = false; |
| 86 cc::BeginFrameArgs last_begin_frame_args_; | 85 cc::BeginFrameArgs last_begin_frame_args_; |
| 87 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; | |
| 88 | 86 |
| 89 base::WeakPtrFactory<CompositorFrameSinkHolder> weak_factory_; | 87 base::WeakPtrFactory<CompositorFrameSinkHolder> weak_factory_; |
| 90 | 88 |
| 91 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder); | 89 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder); |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 } // namespace exo | 92 } // namespace exo |
| 95 | 93 |
| 96 #endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ | 94 #endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ |
| OLD | NEW |