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 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 compositor_frame.delegated_frame_data->render_pass_list.back() | 61 compositor_frame.delegated_frame_data->render_pass_list.back() |
62 ->output_rect.size(); | 62 ->output_rect.size(); |
63 if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) { | 63 if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) { |
64 if (!surface_id_.is_null()) | 64 if (!surface_id_.is_null()) |
65 factory_.Destroy(surface_id_); | 65 factory_.Destroy(surface_id_); |
66 // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory. | 66 // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory. |
67 surface_id_ = delegate_->GenerateSurfaceId(); | 67 surface_id_ = delegate_->GenerateSurfaceId(); |
68 factory_.Create(surface_id_); | 68 factory_.Create(surface_id_); |
69 last_submitted_frame_size_ = frame_size; | 69 last_submitted_frame_size_ = frame_size; |
70 } | 70 } |
71 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame), | 71 std::unique_ptr<cc::CompositorFrame> compositor_frame_copy( |
| 72 new cc::CompositorFrame); |
| 73 *compositor_frame_copy = std::move(compositor_frame); |
| 74 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame_copy), |
72 base::Bind(&CallCallback, callback)); | 75 base::Bind(&CallCallback, callback)); |
73 } | 76 } |
74 | 77 |
75 void CompositorFrameSinkImpl::ReturnResources( | 78 void CompositorFrameSinkImpl::ReturnResources( |
76 const cc::ReturnedResourceArray& resources) { | 79 const cc::ReturnedResourceArray& resources) { |
77 if (!client_) | 80 if (!client_) |
78 return; | 81 return; |
79 | 82 |
80 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); | 83 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); |
81 } | 84 } |
(...skipping 21 matching lines...) Expand all Loading... |
103 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) { | 106 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) { |
104 // TODO(fsamuel): Implement this. | 107 // TODO(fsamuel): Implement this. |
105 } | 108 } |
106 | 109 |
107 void CompositorFrameSinkImpl::OnConnectionLost() { | 110 void CompositorFrameSinkImpl::OnConnectionLost() { |
108 delegate_->CompositorFrameSinkConnectionLost(sink_id_); | 111 delegate_->CompositorFrameSinkConnectionLost(sink_id_); |
109 } | 112 } |
110 | 113 |
111 } // namespace gpu | 114 } // namespace gpu |
112 } // namespace mus | 115 } // namespace mus |
OLD | NEW |