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..8a8aaf498134c4e9c3205f0803783bff5a660323 100644 |
--- a/services/ui/surfaces/display_output_surface.cc |
+++ b/services/ui/surfaces/display_output_surface.cc |
@@ -15,6 +15,8 @@ |
#include "cc/scheduler/begin_frame_source.h" |
#include "gpu/command_buffer/client/context_support.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
+#include "gpu/ipc/gl_in_process_context.h" |
+#include "components/latency_tracker/latency_tracker.h" |
namespace ui { |
@@ -23,6 +25,7 @@ DisplayOutputSurface::DisplayOutputSurface( |
cc::SyntheticBeginFrameSource* synthetic_begin_frame_source) |
: cc::OutputSurface(context_provider), |
synthetic_begin_frame_source_(synthetic_begin_frame_source), |
+ latency_tracker_(new latency_tracker::LatencyTracker), |
weak_ptr_factory_(this) { |
capabilities_.flipped_output_surface = |
context_provider->ContextCapabilities().flips_vertically; |
@@ -34,6 +37,7 @@ DisplayOutputSurface::DisplayOutputSurface( |
context_provider->SetUpdateVSyncParametersCallback( |
base::Bind(&DisplayOutputSurface::OnVSyncParametersUpdated, |
weak_ptr_factory_.GetWeakPtr())); |
+ in_process_command_buffer_ = context_provider->context()->GetInProcessCommandBuffer(); |
} |
DisplayOutputSurface::~DisplayOutputSurface() {} |
@@ -79,12 +83,16 @@ void DisplayOutputSurface::Reshape(const gfx::Size& size, |
void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { |
DCHECK(context_provider_); |
+ |
+ if (frame.latency_info.size() > 0) |
+ in_process_command_buffer_->SetLatencyInfo(frame.latency_info); |
mfomitchev
2017/03/23 15:11:16
This is why I am adding all this new plumbing in G
|
+ |
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*/); |
} |
} |
@@ -126,6 +134,18 @@ void DisplayOutputSurface::OnGpuSwapBuffersCompleted( |
const std::vector<ui::LatencyInfo>& latency_info, |
gfx::SwapResult result, |
const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
+ for (const auto& lat_elt : latency_info) { |
+ for (const auto& lc : lat_elt.latency_components()) { |
+ // TODO: Make this check a method in LatencyTracker, also use it in RWHImpl? |
+ if (lc.first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || |
+ lc.first.first == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT || |
+ lc.first.first == ui::TAB_SHOW_COMPONENT) { |
+ // TODO(mfomitchev): Figure out how to pass the proper value for |
+ // |is_running_navigation_hint_task|. |
+ latency_tracker_->OnGpuSwapBufersCompleted(lat_elt, false); |
+ } |
+ } |
+ } |
DidReceiveSwapBuffersAck(result); |
} |