| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h" | 5 #include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h" |
| 6 | 6 |
| 7 #include "cc/ipc/compositor_frame.mojom.h" | 7 #include "cc/ipc/compositor_frame.mojom.h" |
| 8 #include "cc/surfaces/surface_factory.h" | 8 #include "cc/surfaces/surface_factory.h" |
| 9 #include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h
" | 9 #include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h
" |
| 10 #include "components/mus/public/cpp/surfaces/surfaces_type_converters.h" | 10 #include "components/mus/public/cpp/surfaces/surfaces_type_converters.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 else | 53 else |
| 54 begin_frame_source_->RemoveObserver(this); | 54 begin_frame_source_->RemoveObserver(this); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 void CompositorFrameSinkImpl::SubmitCompositorFrame( | 58 void CompositorFrameSinkImpl::SubmitCompositorFrame( |
| 59 cc::mojom::CompositorFramePtr frame, | 59 cc::mojom::CompositorFramePtr frame, |
| 60 const SubmitCompositorFrameCallback& callback) { | 60 const SubmitCompositorFrameCallback& callback) { |
| 61 // TODO(fsamuel): Validate that SurfaceDrawQuad refer to allowable surface | 61 // TODO(fsamuel): Validate that SurfaceDrawQuad refer to allowable surface |
| 62 // IDs. | 62 // IDs. |
| 63 std::unique_ptr<cc::CompositorFrame> compositor_frame = | 63 cc::CompositorFrame compositor_frame = ConvertToCompositorFrame(frame); |
| 64 ConvertToCompositorFrame(frame); | |
| 65 gfx::Size frame_size = | 64 gfx::Size frame_size = |
| 66 compositor_frame->delegated_frame_data->render_pass_list.back() | 65 compositor_frame.delegated_frame_data->render_pass_list.back() |
| 67 ->output_rect.size(); | 66 ->output_rect.size(); |
| 68 if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) { | 67 if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) { |
| 69 if (!surface_id_.is_null()) | 68 if (!surface_id_.is_null()) |
| 70 factory_.Destroy(surface_id_); | 69 factory_.Destroy(surface_id_); |
| 71 // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory. | 70 // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory. |
| 72 surface_id_ = delegate_->GenerateSurfaceId(); | 71 surface_id_ = delegate_->GenerateSurfaceId(); |
| 73 factory_.Create(surface_id_); | 72 factory_.Create(surface_id_); |
| 74 last_submitted_frame_size_ = frame_size; | 73 last_submitted_frame_size_ = frame_size; |
| 75 } | 74 } |
| 76 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame), | 75 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) { | 107 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) { |
| 109 // TODO(fsamuel): Implement this. | 108 // TODO(fsamuel): Implement this. |
| 110 } | 109 } |
| 111 | 110 |
| 112 void CompositorFrameSinkImpl::OnConnectionLost() { | 111 void CompositorFrameSinkImpl::OnConnectionLost() { |
| 113 delegate_->CompositorFrameSinkConnectionLost(sink_id_); | 112 delegate_->CompositorFrameSinkConnectionLost(sink_id_); |
| 114 } | 113 } |
| 115 | 114 |
| 116 } // namespace gpu | 115 } // namespace gpu |
| 117 } // namespace mus | 116 } // namespace mus |
| OLD | NEW |