Index: components/exo/surface.cc |
diff --git a/components/exo/surface.cc b/components/exo/surface.cc |
index f295aaa46096e5edef0e3a5c9121a23820f4fdb3..fde77d512016805db0eaba88a47e48e81bd2b950 100644 |
--- a/components/exo/surface.cc |
+++ b/components/exo/surface.cc |
@@ -17,6 +17,7 @@ |
#include "cc/quads/solid_color_draw_quad.h" |
#include "cc/quads/texture_draw_quad.h" |
#include "cc/resources/single_release_callback.h" |
+#include "cc/surfaces/sequence_surface_reference_factory.h" |
#include "cc/surfaces/surface.h" |
#include "cc/surfaces/surface_id_allocator.h" |
#include "components/exo/buffer.h" |
@@ -45,6 +46,27 @@ DECLARE_WINDOW_PROPERTY_TYPE(exo::Surface*); |
namespace exo { |
namespace { |
+class ExoSurfaceReferenceFactory : public cc::SequenceSurfaceReferenceFactory { |
Fady Samuel
2016/12/12 23:35:46
Drop Exo, it's redundant in this case. For example
|
+ public: |
+ explicit ExoSurfaceReferenceFactory( |
+ scoped_refptr<CompositorFrameSinkHolder> sink_holder) |
+ : sink_holder_(sink_holder) {} |
+ |
+ protected: |
+ ~ExoSurfaceReferenceFactory() override = default; |
+ |
+ private: |
+ void SatisfySequence(const cc::SurfaceSequence& sequence) const override { |
+ sink_holder_->Satisfy(sequence); |
+ } |
+ void RequireSequence(const cc::SurfaceId& surface_id, |
+ const cc::SurfaceSequence& sequence) const override { |
+ sink_holder_->Require(surface_id, sequence); |
+ } |
+ scoped_refptr<CompositorFrameSinkHolder> sink_holder_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExoSurfaceReferenceFactory); |
+}; |
Fady Samuel
2016/12/12 23:35:46
nit: new line after
|
// A property key containing the surface that is associated with |
// window. If unset, no surface is associated with window. |
DEFINE_WINDOW_PROPERTY_KEY(Surface*, kSurfaceKey, nullptr); |
@@ -417,13 +439,13 @@ void Surface::CommitSurfaceHierarchy() { |
// mirror layer to update its surface using the latest bounds. |
window_->layer()->SetBounds( |
gfx::Rect(window_->layer()->bounds().origin(), content_size_)); |
+ cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); |
+ scoped_refptr<cc::SurfaceReferenceFactory> ref_factory = |
Fady Samuel
2016/12/12 23:35:46
Can we put this as a member variable of exo::Surfa
|
+ new ExoSurfaceReferenceFactory(compositor_frame_sink_holder_); |
window_->layer()->SetShowSurface( |
- cc::SurfaceId(frame_sink_id_, local_frame_id_), |
- base::Bind(&CompositorFrameSinkHolder::Satisfy, |
- compositor_frame_sink_holder_), |
- base::Bind(&CompositorFrameSinkHolder::Require, |
- compositor_frame_sink_holder_), |
- content_size_, contents_surface_to_layer_scale, content_size_); |
+ cc::SurfaceInfo(surface_id, contents_surface_to_layer_scale, |
+ content_size_), |
+ std::move(ref_factory), content_size_); |
window_->layer()->SetFillsBoundsOpaquely( |
state_.blend_mode == SkBlendMode::kSrc || |
state_.opaque_region.contains( |