Chromium Code Reviews| Index: services/ui/ws/compositor_frame_sink_client_binding.cc |
| diff --git a/services/ui/ws/compositor_frame_sink_client_binding.cc b/services/ui/ws/compositor_frame_sink_client_binding.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..019d599e7964d3457ff0f3a656e94af99e75d7fc |
| --- /dev/null |
| +++ b/services/ui/ws/compositor_frame_sink_client_binding.cc |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "services/ui/ws/compositor_frame_sink_client_binding.h" |
| + |
| +namespace ui { |
| +namespace ws { |
| + |
| +CompositorFrameSinkClientBinding::CompositorFrameSinkClientBinding( |
| + cc::mojom::MojoCompositorFrameSinkClient* sink_client, |
| + cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request, |
| + cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink, |
| + cc::mojom::DisplayPrivateAssociatedPtr display_private) |
| + : binding_(sink_client, std::move(sink_client_request)), |
| + display_private_(std::move(display_private)), |
| + compositor_frame_sink_(std::move(compositor_frame_sink)) {} |
| + |
| +CompositorFrameSinkClientBinding::~CompositorFrameSinkClientBinding() = default; |
| + |
| +void CompositorFrameSinkClientBinding::SetNeedsBeginFrame( |
| + bool needs_begin_frame) { |
| + compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frame); |
| +} |
| + |
| +void CompositorFrameSinkClientBinding::SubmitCompositorFrame( |
| + const cc::LocalSurfaceId& local_surface_id, |
| + cc::CompositorFrame frame) { |
| + if (local_surface_id != local_surface_id_) { |
| + local_surface_id_ = local_surface_id; |
| + gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
| + display_private_->ResizeDisplay(frame_size); |
| + display_private_->SetLocalSurfaceId(local_surface_id_, |
| + frame.metadata.device_scale_factor); |
| + } |
| + compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, |
| + std::move(frame)); |
| + compositor_frame_sink_->SetNeedsBeginFrame(false); |
|
Fady Samuel
2017/05/19 14:40:33
Oops, just noticed this. It doesn't make sense to
Alex Z.
2017/05/19 14:42:23
Good catch. This line is removed.
|
| +} |
| + |
| +void CompositorFrameSinkClientBinding::BeginFrameDidNotSwap( |
| + const cc::BeginFrameAck& ack) { |
| + compositor_frame_sink_->BeginFrameDidNotSwap(ack); |
| +} |
| + |
| +void CompositorFrameSinkClientBinding::EvictCurrentSurface() { |
| + compositor_frame_sink_->EvictCurrentSurface(); |
| +} |
| + |
| +} // namespace ws |
| +} // namespace ui |