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

Side by Side Diff: cc/layers/surface_layer.h

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: x Created 4 years 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 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 "base/macros.h" 8 #include "base/macros.h"
9 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
11 #include "cc/surfaces/surface_embedding_base.h"
11 #include "cc/surfaces/surface_id.h" 12 #include "cc/surfaces/surface_id.h"
12 #include "cc/surfaces/surface_sequence.h" 13 #include "cc/surfaces/surface_sequence.h"
13 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
14 15
15 namespace cc { 16 namespace cc {
16 17
17 // A layer that renders a surface referencing the output of another compositor 18 // A layer that renders a surface referencing the output of another compositor
18 // instance or client. 19 // instance or client.
19 class CC_EXPORT SurfaceLayer : public Layer { 20 class CC_EXPORT SurfaceLayer : public Layer {
20 public: 21 public:
21 // This callback is run when a SurfaceSequence needs to be satisfied, but 22 static scoped_refptr<SurfaceLayer> Create();
22 // the parent compositor is unable to. It can be called on either the main 23 static scoped_refptr<SurfaceLayer> Create(SurfaceEmbeddingPtr);
Fady Samuel 2016/12/07 23:29:04 TBH, I'm not a fan of this typedef. How about jus
23 // or impl threads.
24 using SatisfyCallback = base::Callback<void(const SurfaceSequence&)>;
25 24
26 // This callback is run to require that a specific SurfaceSequence is 25 void SetSurfaceEmbedding(SurfaceEmbeddingPtr surface_ref);
27 // received before a SurfaceId is destroyed.
28 using RequireCallback =
29 base::Callback<void(const SurfaceId&, const SurfaceSequence&)>;
30
31 static scoped_refptr<SurfaceLayer> Create(
32 const SatisfyCallback& satisfy_callback,
33 const RequireCallback& require_callback);
34
35 void SetSurfaceId(const SurfaceId& surface_id,
36 float scale,
37 const gfx::Size& size);
38 26
39 // Layer overrides. 27 // Layer overrides.
40 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 28 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
41 void SetLayerTreeHost(LayerTreeHost* host) override; 29 void SetLayerTreeHost(LayerTreeHost* host) override;
42 void PushPropertiesTo(LayerImpl* layer) override; 30 void PushPropertiesTo(LayerImpl* layer) override;
43 31
44 SurfaceId surface_id() const { return surface_id_; } 32 const SurfaceEmbeddingPtr& surface_emb() const { return surface_emb_; }
Fady Samuel 2016/12/07 23:29:04 surface_embedding()
45 const gfx::Size& surface_size() const { return surface_size_; } 33 SurfaceId surface_id() const { return surface_emb_->id(); }
46 float surface_scale() const { return surface_scale_; } 34 const gfx::Size& surface_size() const { return surface_emb_->size(); }
47 35 float surface_scale() const { return surface_emb_->scale(); }
48 const SatisfyCallback& satisfy_callback() const { return satisfy_callback_; }
49 const RequireCallback& require_callback() const { return require_callback_; }
50 36
51 protected: 37 protected:
52 SurfaceLayer(const SatisfyCallback& satisfy_callback, 38 SurfaceLayer();
53 const RequireCallback& require_callback); 39 explicit SurfaceLayer(SurfaceEmbeddingPtr);
54 bool HasDrawableContent() const override; 40 bool HasDrawableContent() const override;
55 41
56 private: 42 private:
57 ~SurfaceLayer() override; 43 ~SurfaceLayer() override;
58 void CreateNewDestroySequence(); 44 void RemoveCurrentReference();
59 void SatisfyDestroySequence();
60 45
61 SurfaceId surface_id_; 46 SurfaceEmbeddingPtr surface_emb_;
62 gfx::Size surface_size_; 47 SurfaceEmbeddingPtr current_ref_;
Fady Samuel 2016/12/07 23:29:05 I don't understand the difference between these tw
63 float surface_scale_;
64 SurfaceSequence destroy_sequence_;
65 SatisfyCallback satisfy_callback_;
66 RequireCallback require_callback_;
67 48
68 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer); 49 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer);
69 }; 50 };
70 51
71 } // namespace cc 52 } // namespace cc
72 53
73 #endif // CC_LAYERS_SURFACE_LAYER_H_ 54 #endif // CC_LAYERS_SURFACE_LAYER_H_
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/layers/surface_layer.cc » ('j') | cc/layers/surface_layer_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698