| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/public/cpp/client_compositor_frame_sink.h" | 5 #include "services/ui/public/cpp/client_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/base/switches.h" | 10 #include "cc/base/switches.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 gpu_memory_buffer_manager, | 105 gpu_memory_buffer_manager, |
| 106 nullptr), | 106 nullptr), |
| 107 compositor_frame_sink_info_(std::move(compositor_frame_sink_info)), | 107 compositor_frame_sink_info_(std::move(compositor_frame_sink_info)), |
| 108 client_request_(std::move(client_request)), | 108 client_request_(std::move(client_request)), |
| 109 frame_sink_id_(frame_sink_id) { | 109 frame_sink_id_(frame_sink_id) { |
| 110 enable_surface_synchronization_ = | 110 enable_surface_synchronization_ = |
| 111 base::CommandLine::ForCurrentProcess()->HasSwitch( | 111 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 112 cc::switches::kEnableSurfaceSynchronization); | 112 cc::switches::kEnableSurfaceSynchronization); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void ClientCompositorFrameSink::DidReceiveCompositorFrameAck() { | 115 void ClientCompositorFrameSink::DidReceiveCompositorFrameAck( |
| 116 const cc::ReturnedResourceArray& resources) { |
| 116 DCHECK(thread_checker_); | 117 DCHECK(thread_checker_); |
| 117 DCHECK(thread_checker_->CalledOnValidThread()); | 118 DCHECK(thread_checker_->CalledOnValidThread()); |
| 118 if (!client_) | 119 if (!client_) |
| 119 return; | 120 return; |
| 121 client_->ReclaimResources(resources); |
| 120 client_->DidReceiveCompositorFrameAck(); | 122 client_->DidReceiveCompositorFrameAck(); |
| 121 } | 123 } |
| 122 | 124 |
| 123 void ClientCompositorFrameSink::OnBeginFrame( | 125 void ClientCompositorFrameSink::OnBeginFrame( |
| 124 const cc::BeginFrameArgs& begin_frame_args) { | 126 const cc::BeginFrameArgs& begin_frame_args) { |
| 125 begin_frame_source_->OnBeginFrame(begin_frame_args); | 127 begin_frame_source_->OnBeginFrame(begin_frame_args); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void ClientCompositorFrameSink::ReclaimResources( | 130 void ClientCompositorFrameSink::ReclaimResources( |
| 129 const cc::ReturnedResourceArray& resources) { | 131 const cc::ReturnedResourceArray& resources) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 157 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() { | 159 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() { |
| 158 return std::move(compositor_frame_sink_request_); | 160 return std::move(compositor_frame_sink_request_); |
| 159 } | 161 } |
| 160 | 162 |
| 161 cc::mojom::MojoCompositorFrameSinkClientPtrInfo | 163 cc::mojom::MojoCompositorFrameSinkClientPtrInfo |
| 162 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() { | 164 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() { |
| 163 return std::move(compositor_frame_sink_client_); | 165 return std::move(compositor_frame_sink_client_); |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace ui | 168 } // namespace ui |
| OLD | NEW |