OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CC_LAYERS_SURFACE_LAYER_H_ | 5 #ifndef CC_LAYERS_SURFACE_LAYER_H_ |
6 #define CC_LAYERS_SURFACE_LAYER_H_ | 6 #define CC_LAYERS_SURFACE_LAYER_H_ |
7 | 7 |
8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/surfaces/surface_id.h" | 10 #include "cc/surfaces/surface_id.h" |
| 11 #include "cc/surfaces/surface_sequence.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 // A layer that renders a surface referencing the output of another compositor | 15 // A layer that renders a surface referencing the output of another compositor |
15 // instance or client. | 16 // instance or client. |
16 class CC_EXPORT SurfaceLayer : public Layer { | 17 class CC_EXPORT SurfaceLayer : public Layer { |
17 public: | 18 public: |
18 static scoped_refptr<SurfaceLayer> Create(); | 19 // This callback is run when a SurfaceSequence needs to be satisfied, but |
| 20 // the parent compositor is unable to. It can be called on either the main |
| 21 // or impl threads. |
| 22 using SatisfyCallback = base::Callback<void(SurfaceSequence)>; |
| 23 |
| 24 // This callback is run to require that a specific SurfaceSequence is |
| 25 // received before a SurfaceId is destroyed. |
| 26 using RequireCallback = base::Callback<void(SurfaceId, SurfaceSequence)>; |
| 27 |
| 28 static scoped_refptr<SurfaceLayer> Create( |
| 29 const SatisfyCallback& satisfy_callback, |
| 30 const RequireCallback& require_callback); |
19 | 31 |
20 void SetSurfaceId(SurfaceId surface_id); | 32 void SetSurfaceId(SurfaceId surface_id); |
21 | 33 |
22 // Layer overrides. | 34 // Layer overrides. |
23 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 35 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 36 void SetLayerTreeHost(LayerTreeHost* host) override; |
24 void PushPropertiesTo(LayerImpl* layer) override; | 37 void PushPropertiesTo(LayerImpl* layer) override; |
25 | 38 |
26 protected: | 39 protected: |
27 SurfaceLayer(); | 40 SurfaceLayer(const SatisfyCallback& satisfy_callback, |
| 41 const RequireCallback& require_callback); |
28 bool HasDrawableContent() const override; | 42 bool HasDrawableContent() const override; |
29 | 43 |
30 private: | 44 private: |
31 ~SurfaceLayer() override; | 45 ~SurfaceLayer() override; |
| 46 void CreateNewDestroySequence(); |
| 47 void SatisfyDestroySequence(); |
32 | 48 |
33 SurfaceId surface_id_; | 49 SurfaceId surface_id_; |
| 50 SurfaceSequence destroy_sequence_; |
| 51 SatisfyCallback satisfy_callback_; |
| 52 RequireCallback require_callback_; |
34 | 53 |
35 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer); | 54 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer); |
36 }; | 55 }; |
37 | 56 |
38 } // namespace cc | 57 } // namespace cc |
39 | 58 |
40 #endif // CC_LAYERS_SURFACE_LAYER_H_ | 59 #endif // CC_LAYERS_SURFACE_LAYER_H_ |
OLD | NEW |