OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/ui/ws/display_client_compositor_frame_sink.h" | 5 #include "services/ui/ws/display_client_compositor_frame_sink.h" |
6 | 6 |
7 #include "base/threading/thread_checker.h" | 7 #include "base/threading/thread_checker.h" |
8 #include "cc/output/compositor_frame_sink_client.h" | 8 #include "cc/output/compositor_frame_sink_client.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 local_surface_id_ = id_allocator_.GenerateId(); | 60 local_surface_id_ = id_allocator_.GenerateId(); |
61 display_private_->ResizeDisplay(frame_size); | 61 display_private_->ResizeDisplay(frame_size); |
62 } | 62 } |
63 display_private_->SetLocalSurfaceId(local_surface_id_, | 63 display_private_->SetLocalSurfaceId(local_surface_id_, |
64 frame.metadata.device_scale_factor); | 64 frame.metadata.device_scale_factor); |
65 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, | 65 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, |
66 std::move(frame)); | 66 std::move(frame)); |
67 last_submitted_frame_size_ = frame_size; | 67 last_submitted_frame_size_ = frame_size; |
68 } | 68 } |
69 | 69 |
70 void DisplayClientCompositorFrameSink::DidReceiveCompositorFrameAck() { | 70 void DisplayClientCompositorFrameSink::DidReceiveCompositorFrameAck( |
| 71 const cc::ReturnedResourceArray& resources) { |
71 DCHECK(thread_checker_->CalledOnValidThread()); | 72 DCHECK(thread_checker_->CalledOnValidThread()); |
72 if (!client_) | 73 if (!client_) |
73 return; | 74 return; |
| 75 client_->ReclaimResources(resources); |
74 client_->DidReceiveCompositorFrameAck(); | 76 client_->DidReceiveCompositorFrameAck(); |
75 } | 77 } |
76 | 78 |
77 void DisplayClientCompositorFrameSink::OnBeginFrame( | 79 void DisplayClientCompositorFrameSink::OnBeginFrame( |
78 const cc::BeginFrameArgs& begin_frame_args) { | 80 const cc::BeginFrameArgs& begin_frame_args) { |
79 DCHECK(thread_checker_->CalledOnValidThread()); | 81 DCHECK(thread_checker_->CalledOnValidThread()); |
80 begin_frame_source_->OnBeginFrame(begin_frame_args); | 82 begin_frame_source_->OnBeginFrame(begin_frame_args); |
81 } | 83 } |
82 | 84 |
83 void DisplayClientCompositorFrameSink::ReclaimResources( | 85 void DisplayClientCompositorFrameSink::ReclaimResources( |
(...skipping 12 matching lines...) Expand all Loading... |
96 | 98 |
97 void DisplayClientCompositorFrameSink::OnDidFinishFrame( | 99 void DisplayClientCompositorFrameSink::OnDidFinishFrame( |
98 const cc::BeginFrameAck& ack) { | 100 const cc::BeginFrameAck& ack) { |
99 // If there was damage, the submitted CompositorFrame includes the ack. | 101 // If there was damage, the submitted CompositorFrame includes the ack. |
100 if (!ack.has_damage) | 102 if (!ack.has_damage) |
101 compositor_frame_sink_->BeginFrameDidNotSwap(ack); | 103 compositor_frame_sink_->BeginFrameDidNotSwap(ack); |
102 } | 104 } |
103 | 105 |
104 } // namespace ws | 106 } // namespace ws |
105 } // namespace ui | 107 } // namespace ui |
OLD | NEW |