Chromium Code Reviews| Index: components/exo/surface.cc |
| diff --git a/components/exo/surface.cc b/components/exo/surface.cc |
| index 88e6ad038039c541d0f139953c7f4c0c447df4f8..0877ba6c8f0fafaa194d68484244917c9a957eb7 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,30 @@ DECLARE_WINDOW_PROPERTY_TYPE(exo::Surface*); |
| namespace exo { |
| namespace { |
| +class SurfaceReferenceFactory : public cc::SequenceSurfaceReferenceFactory { |
|
reveman
2016/12/15 19:59:58
Please move this below the CustomWindowTargeter cl
Saman Sami
2016/12/15 20:41:37
Done.
|
| + public: |
| + explicit SurfaceReferenceFactory( |
| + scoped_refptr<CompositorFrameSinkHolder> sink_holder) |
|
reveman
2016/12/15 19:59:58
s/scoped_refptr<CompositorFrameSinkHolder>/Composi
Saman Sami
2016/12/15 20:41:37
Done.
|
| + : sink_holder_(std::move(sink_holder)) {} |
| + |
| + private: |
| + ~SurfaceReferenceFactory() override = default; |
| + |
| + // cc::SequenceSurfaceReferenceFactory implementation: |
|
reveman
2016/12/15 19:59:58
nit: "// Overridden from cc::SequenceSurfaceRefere
Saman Sami
2016/12/15 20:41:37
Done.
|
| + 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(SurfaceReferenceFactory); |
| +}; |
| + |
| // 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); |
| @@ -162,6 +187,7 @@ Surface::Surface() |
| std::move(frame_sink_holder_ptr))); |
| compositor_frame_sink_holder_ = new CompositorFrameSinkHolder( |
| this, std::move(frame_sink), std::move(frame_sink_client_request)); |
| + ref_factory_ = new SurfaceReferenceFactory(compositor_frame_sink_holder_); |
| window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| window_->SetName("ExoSurface"); |
| window_->SetProperty(kSurfaceKey, this); |
| @@ -422,13 +448,11 @@ 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_); |
| 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); |
| + cc::SurfaceInfo(surface_id, contents_surface_to_layer_scale, |
| + content_size_), |
| + ref_factory_); |
| window_->layer()->SetFillsBoundsOpaquely( |
| state_.blend_mode == SkBlendMode::kSrc || |
| state_.opaque_region.contains( |