| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/surfaces/gpu_compositor_frame_sink.h" | 5 #include "services/ui/surfaces/gpu_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 surface_factory_.SubmitCompositorFrame( | 90 surface_factory_.SubmitCompositorFrame( |
| 91 local_frame_id_, std::move(frame), | 91 local_frame_id_, std::move(frame), |
| 92 base::Bind(&GpuCompositorFrameSink::DidReceiveCompositorFrameAck, | 92 base::Bind(&GpuCompositorFrameSink::DidReceiveCompositorFrameAck, |
| 93 weak_factory_.GetWeakPtr())); | 93 weak_factory_.GetWeakPtr())); |
| 94 if (display_) { | 94 if (display_) { |
| 95 display_->SetLocalFrameId(local_frame_id_, | 95 display_->SetLocalFrameId(local_frame_id_, |
| 96 frame.metadata.device_scale_factor); | 96 frame.metadata.device_scale_factor); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void GpuCompositorFrameSink::EvictFrame() { |
| 101 // TODO: Implement this |
| 102 } |
| 103 |
| 100 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { | 104 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { |
| 101 if (!client_) | 105 if (!client_) |
| 102 return; | 106 return; |
| 103 client_->DidReceiveCompositorFrameAck(); | 107 client_->DidReceiveCompositorFrameAck(); |
| 104 DCHECK_GT(ack_pending_count_, 0); | 108 DCHECK_GT(ack_pending_count_, 0); |
| 105 if (!surface_returned_resources_.empty()) { | 109 if (!surface_returned_resources_.empty()) { |
| 106 client_->ReclaimResources(surface_returned_resources_); | 110 client_->ReclaimResources(surface_returned_resources_); |
| 107 surface_returned_resources_.clear(); | 111 surface_returned_resources_.clear(); |
| 108 } | 112 } |
| 109 ack_pending_count_--; | 113 ack_pending_count_--; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 240 } |
| 237 | 241 |
| 238 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 242 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
| 239 private_connection_lost_ = true; | 243 private_connection_lost_ = true; |
| 240 // Request destruction of |this| only if both connections are lost. | 244 // Request destruction of |this| only if both connections are lost. |
| 241 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( | 245 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( |
| 242 frame_sink_id_, client_connection_lost_); | 246 frame_sink_id_, client_connection_lost_); |
| 243 } | 247 } |
| 244 | 248 |
| 245 } // namespace ui | 249 } // namespace ui |
| OLD | NEW |