Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Unified Diff: content/common/gpu/image_transport_surface.cc

Issue 1128323006: Fix latency calculation when multiple rendered buffers are in flight. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/image_transport_surface.cc
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index b6367dd4cd8b7e74f153726f5b4a3e7d4b179170..ac5eb2e7e2c649a5cae7c606e1823c8965d15d3f 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -202,9 +202,12 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
// of this class. Callback will not be called once the instance of this class
// is destroyed. However, this also means that the callback can be run on
// the calling thread only.
- return gfx::GLSurfaceAdapter::SwapBuffersAsync(
- base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack,
- weak_ptr_factory_.GetWeakPtr()));
+ std::vector<ui::LatencyInfo>* latency_info_ptr =
+ new std::vector<ui::LatencyInfo>();
+ latency_info_ptr->swap(latency_info_);
+ return gfx::GLSurfaceAdapter::SwapBuffersAsync(base::Bind(
+ &PassThroughImageTransportSurface::SwapBuffersCallBack,
+ weak_ptr_factory_.GetWeakPtr(), base::Owned(latency_info_ptr)));
}
bool PassThroughImageTransportSurface::PostSubBuffer(
@@ -221,21 +224,26 @@ bool PassThroughImageTransportSurface::PostSubBuffer(
// of this class. Callback will not be called once the instance of this class
// is destroyed. However, this also means that the callback can be run on
// the calling thread only.
- return gfx::GLSurfaceAdapter::PostSubBufferAsync(x, y, width, height,
+ std::vector<ui::LatencyInfo>* latency_info_ptr =
+ new std::vector<ui::LatencyInfo>();
+ latency_info_ptr->swap(latency_info_);
+ return gfx::GLSurfaceAdapter::PostSubBufferAsync(
+ x, y, width, height,
base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack,
- weak_ptr_factory_.GetWeakPtr()));
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Owned(latency_info_ptr)));
}
-void PassThroughImageTransportSurface::SwapBuffersCallBack() {
+void PassThroughImageTransportSurface::SwapBuffersCallBack(
+ std::vector<ui::LatencyInfo>* latency_info_ptr) {
base::TimeTicks swap_ack_time = base::TimeTicks::Now();
- for (auto& latency : latency_info_) {
+ for (auto& latency : *latency_info_ptr) {
latency.AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
swap_ack_time, 1);
}
- helper_->stub()->SendSwapBuffersCompleted(latency_info_);
- latency_info_.clear();
+ helper_->stub()->SendSwapBuffersCompleted(*latency_info_ptr);
}
bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698