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 "gpu/ipc/service/pass_through_image_transport_surface.h" | 5 #include "gpu/ipc/service/pass_through_image_transport_surface.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 new std::vector<ui::LatencyInfo>()); | 195 new std::vector<ui::LatencyInfo>()); |
196 latency_info->swap(latency_info_); | 196 latency_info->swap(latency_info_); |
197 | 197 |
198 return latency_info; | 198 return latency_info; |
199 } | 199 } |
200 | 200 |
201 void PassThroughImageTransportSurface::FinishSwapBuffers( | 201 void PassThroughImageTransportSurface::FinishSwapBuffers( |
202 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, | 202 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, |
203 gfx::SwapResult result) { | 203 gfx::SwapResult result) { |
204 base::TimeTicks swap_ack_time = base::TimeTicks::Now(); | 204 base::TimeTicks swap_ack_time = base::TimeTicks::Now(); |
| 205 bool has_browser_snapshot_request = false; |
205 for (auto& latency : *latency_info) { | 206 for (auto& latency : *latency_info) { |
206 latency.AddLatencyNumberWithTimestamp( | 207 latency.AddLatencyNumberWithTimestamp( |
207 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, | 208 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, |
208 swap_ack_time, 1); | 209 swap_ack_time, 1); |
| 210 has_browser_snapshot_request |= latency.FindLatency( |
| 211 ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, nullptr); |
209 } | 212 } |
| 213 if (has_browser_snapshot_request) |
| 214 WaitForSnapshotRendering(); |
210 | 215 |
211 if (delegate_) { | 216 if (delegate_) { |
212 SwapBuffersCompleteParams params; | 217 SwapBuffersCompleteParams params; |
213 params.latency_info = std::move(*latency_info); | 218 params.latency_info = std::move(*latency_info); |
214 params.result = result; | 219 params.result = result; |
215 delegate_->DidSwapBuffersComplete(std::move(params)); | 220 delegate_->DidSwapBuffersComplete(std::move(params)); |
216 } | 221 } |
217 } | 222 } |
218 | 223 |
219 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( | 224 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( |
220 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, | 225 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, |
221 GLSurface::SwapCompletionCallback callback, | 226 GLSurface::SwapCompletionCallback callback, |
222 gfx::SwapResult result) { | 227 gfx::SwapResult result) { |
223 FinishSwapBuffers(std::move(latency_info), result); | 228 FinishSwapBuffers(std::move(latency_info), result); |
224 callback.Run(result); | 229 callback.Run(result); |
225 } | 230 } |
226 | 231 |
227 } // namespace gpu | 232 } // namespace gpu |
OLD | NEW |