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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 local_surface_id_ = id_allocator_.GenerateId(); | 58 local_surface_id_ = id_allocator_.GenerateId(); |
59 display_private_->ResizeDisplay(frame_size); | 59 display_private_->ResizeDisplay(frame_size); |
60 } | 60 } |
61 display_private_->SetLocalSurfaceId(local_surface_id_, | 61 display_private_->SetLocalSurfaceId(local_surface_id_, |
62 frame.metadata.device_scale_factor); | 62 frame.metadata.device_scale_factor); |
63 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, | 63 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, |
64 std::move(frame)); | 64 std::move(frame)); |
65 last_submitted_frame_size_ = frame_size; | 65 last_submitted_frame_size_ = frame_size; |
66 } | 66 } |
67 | 67 |
| 68 void DisplayClientCompositorFrameSink::EvictFrame() { |
| 69 DCHECK(thread_checker_->CalledOnValidThread()); |
| 70 if (!compositor_frame_sink_) |
| 71 return; |
| 72 compositor_frame_sink_->EvictFrame(); |
| 73 } |
| 74 |
68 void DisplayClientCompositorFrameSink::DidReceiveCompositorFrameAck( | 75 void DisplayClientCompositorFrameSink::DidReceiveCompositorFrameAck( |
69 const cc::ReturnedResourceArray& resources) { | 76 const cc::ReturnedResourceArray& resources) { |
70 DCHECK(thread_checker_->CalledOnValidThread()); | 77 DCHECK(thread_checker_->CalledOnValidThread()); |
71 if (!client_) | 78 if (!client_) |
72 return; | 79 return; |
73 client_->ReclaimResources(resources); | 80 client_->ReclaimResources(resources); |
74 client_->DidReceiveCompositorFrameAck(); | 81 client_->DidReceiveCompositorFrameAck(); |
75 } | 82 } |
76 | 83 |
77 void DisplayClientCompositorFrameSink::OnBeginFrame( | 84 void DisplayClientCompositorFrameSink::OnBeginFrame( |
(...skipping 18 matching lines...) Expand all Loading... |
96 | 103 |
97 void DisplayClientCompositorFrameSink::OnDidFinishFrame( | 104 void DisplayClientCompositorFrameSink::OnDidFinishFrame( |
98 const cc::BeginFrameAck& ack) { | 105 const cc::BeginFrameAck& ack) { |
99 // If there was damage, the submitted CompositorFrame includes the ack. | 106 // If there was damage, the submitted CompositorFrame includes the ack. |
100 if (!ack.has_damage) | 107 if (!ack.has_damage) |
101 compositor_frame_sink_->BeginFrameDidNotSwap(ack); | 108 compositor_frame_sink_->BeginFrameDidNotSwap(ack); |
102 } | 109 } |
103 | 110 |
104 } // namespace ws | 111 } // namespace ws |
105 } // namespace ui | 112 } // namespace ui |
OLD | NEW |