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

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

Issue 2582823002: WIP: Surface Synchronization System
Patch Set: Only create ClientSurfaceEmbedder if window is visible. Trash it otherwise. Created 3 years, 11 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 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_info.h" 11 #include "cc/surfaces/surface_info.h"
12 #include "cc/surfaces/surface_reference_factory.h" 12 #include "cc/surfaces/surface_reference_factory.h"
13 #include "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 // A layer that renders a surface referencing the output of another compositor 17 // A layer that renders a surface referencing the output of another compositor
18 // instance or client. 18 // instance or client.
19 class CC_EXPORT SurfaceLayer : public Layer { 19 class CC_EXPORT SurfaceLayer : public Layer {
20 public: 20 public:
21 static scoped_refptr<SurfaceLayer> Create( 21 static scoped_refptr<SurfaceLayer> Create(
22 scoped_refptr<SurfaceReferenceFactory> ref_factory); 22 scoped_refptr<SurfaceReferenceFactory> ref_factory);
23 23
24 void SetSurfaceInfo(const SurfaceInfo& surface_info); 24 void SetSurfaceInfo(const SurfaceInfo& surface_info);
25 25
26 // The current |surface_info_| becomes the |fallback_surface_info_| and the
27 // reference to the current fallback is removed.
28 void SwapSurfaceInfo(const SurfaceInfo& surface_info);
29
26 // When stretch_content_to_fill_bounds is true, the scale of the embedded 30 // When stretch_content_to_fill_bounds is true, the scale of the embedded
27 // surface is ignored and the content will be stretched to fill the bounds. 31 // surface is ignored and the content will be stretched to fill the bounds.
28 void SetStretchContentToFillBounds(bool stretch_content_to_fill_bounds); 32 void SetStretchContentToFillBounds(bool stretch_content_to_fill_bounds);
29 33
30 // Layer overrides. 34 // Layer overrides.
31 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 35 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
32 void SetLayerTreeHost(LayerTreeHost* host) override; 36 void SetLayerTreeHost(LayerTreeHost* host) override;
33 void PushPropertiesTo(LayerImpl* layer) override; 37 void PushPropertiesTo(LayerImpl* layer) override;
34 38
35 scoped_refptr<SurfaceReferenceFactory> surface_reference_factory() const { 39 scoped_refptr<SurfaceReferenceFactory> surface_reference_factory() const {
36 return ref_factory_; 40 return ref_factory_;
37 } 41 }
38 const SurfaceInfo& surface_info() const { return surface_info_; } 42
43 const SurfaceInfo& primary_surface_info() const {
44 return primary_surface_info_;
45 }
46
47 const SurfaceInfo& fallback_surface_info() const {
48 return fallback_surface_info_;
49 }
39 50
40 protected: 51 protected:
41 explicit SurfaceLayer(scoped_refptr<SurfaceReferenceFactory> ref_factory); 52 explicit SurfaceLayer(scoped_refptr<SurfaceReferenceFactory> ref_factory);
42 bool HasDrawableContent() const override; 53 bool HasDrawableContent() const override;
43 54
44 private: 55 private:
45 ~SurfaceLayer() override; 56 ~SurfaceLayer() override;
46 void RemoveCurrentReference(); 57 void RemoveReference(base::Closure reference_returner);
47 58
48 SurfaceInfo surface_info_; 59 SurfaceInfo primary_surface_info_;
60 base::Closure primary_reference_returner_;
61
62 SurfaceInfo fallback_surface_info_;
63 base::Closure fallback_reference_returner_;
64
49 scoped_refptr<SurfaceReferenceFactory> ref_factory_; 65 scoped_refptr<SurfaceReferenceFactory> ref_factory_;
50 base::Closure reference_returner_;
51 bool stretch_content_to_fill_bounds_ = false; 66 bool stretch_content_to_fill_bounds_ = false;
52 67
53 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer); 68 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer);
54 }; 69 };
55 70
56 } // namespace cc 71 } // namespace cc
57 72
58 #endif // CC_LAYERS_SURFACE_LAYER_H_ 73 #endif // CC_LAYERS_SURFACE_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698