Index: services/ui/surfaces/display_output_surface.cc |
diff --git a/services/ui/surfaces/display_output_surface.cc b/services/ui/surfaces/display_output_surface.cc |
index 85ece68dd7dfaa9e5d9c8c295e188d26eab6ab94..44ba93cf1b8405eedb605cefeeee1bf246d5cd74 100644 |
--- a/services/ui/surfaces/display_output_surface.cc |
+++ b/services/ui/surfaces/display_output_surface.cc |
@@ -15,6 +15,7 @@ |
#include "cc/scheduler/begin_frame_source.h" |
#include "gpu/command_buffer/client/context_support.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
+#include "ui/latency/latency_tracker.h" |
namespace ui { |
@@ -23,6 +24,7 @@ DisplayOutputSurface::DisplayOutputSurface( |
cc::SyntheticBeginFrameSource* synthetic_begin_frame_source) |
: cc::OutputSurface(context_provider), |
synthetic_begin_frame_source_(synthetic_begin_frame_source), |
+ latency_tracker_(new LatencyTracker), |
weak_ptr_factory_(this) { |
capabilities_.flipped_output_surface = |
context_provider->ContextCapabilities().flips_vertically; |
@@ -79,12 +81,16 @@ void DisplayOutputSurface::Reshape(const gfx::Size& size, |
void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { |
DCHECK(context_provider_); |
+ |
+ if (frame.latency_info.size() > 0) |
+ context_provider_->ContextSupport()->AddLatencyInfo(frame.latency_info); |
+ |
set_draw_rectangle_for_frame_ = false; |
if (frame.sub_buffer_rect) { |
context_provider_->ContextSupport()->PartialSwapBuffers( |
*frame.sub_buffer_rect); |
} else { |
- context_provider_->ContextSupport()->Swap(); |
+ context_provider_->ContextSupport()->Swap(/*frame.latency_info*/); |
} |
} |
@@ -123,9 +129,13 @@ void DisplayOutputSurface::DidReceiveSwapBuffersAck(gfx::SwapResult result) { |
} |
void DisplayOutputSurface::OnGpuSwapBuffersCompleted( |
- const std::vector<ui::LatencyInfo>& latency_info, |
+ const std::vector<LatencyInfo>& latency_info, |
gfx::SwapResult result, |
const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
+ for (const auto& latency : latency_info) { |
+ if (latency.latency_components().size() > 0) |
+ latency_tracker_->OnGpuSwapBuffersCompleted(latency); |
+ } |
DidReceiveSwapBuffersAck(result); |
} |