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 std::unique_ptr<cc::CompositorFrame> compositor_frame_copy( | 71 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame), |
72 new cc::CompositorFrame); | |
73 *compositor_frame_copy = std::move(compositor_frame); | |
74 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame_copy), | |
75 base::Bind(&CallCallback, callback)); | 72 base::Bind(&CallCallback, callback)); |
76 } | 73 } |
77 | 74 |
78 void CompositorFrameSinkImpl::ReturnResources( | 75 void CompositorFrameSinkImpl::ReturnResources( |
79 const cc::ReturnedResourceArray& resources) { | 76 const cc::ReturnedResourceArray& resources) { |
80 if (!client_) | 77 if (!client_) |
81 return; | 78 return; |
82 | 79 |
83 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); | 80 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); |
84 } | 81 } |
(...skipping 21 matching lines...) Expand all Loading... |
106 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) { | 103 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) { |
107 // TODO(fsamuel): Implement this. | 104 // TODO(fsamuel): Implement this. |
108 } | 105 } |
109 | 106 |
110 void CompositorFrameSinkImpl::OnConnectionLost() { | 107 void CompositorFrameSinkImpl::OnConnectionLost() { |
111 delegate_->CompositorFrameSinkConnectionLost(sink_id_); | 108 delegate_->CompositorFrameSinkConnectionLost(sink_id_); |
112 } | 109 } |
113 | 110 |
114 } // namespace gpu | 111 } // namespace gpu |
115 } // namespace mus | 112 } // namespace mus |
OLD | NEW |