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

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

Issue 918883002: Change input latency result to depend on start of GPU swap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup RWHLT Created 5 years, 10 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
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 7e01bc13f7952607375e06536442decbd91f85eb..b86be03ef497cfe154f9931f91af083d8cab85bc 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -203,8 +203,12 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
// GetVsyncValues before SwapBuffers to work around Mali driver bug:
// crbug.com/223558.
SendVSyncUpdateIfAvailable();
- for (auto& latency : latency_info_)
- latency.AddLatencyNumber(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0);
+
+ base::TimeTicks swap_time = base::TimeTicks::Now();
+ for (auto& latency : latency_info_) {
+ latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1);
+ }
// We use WeakPtr here to avoid manual management of life time of an instance
// of this class. Callback will not be called once the instance of this class
@@ -218,6 +222,13 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
bool PassThroughImageTransportSurface::PostSubBuffer(
int x, int y, int width, int height) {
SendVSyncUpdateIfAvailable();
+
+ base::TimeTicks swap_time = base::TimeTicks::Now();
+ for (auto& latency : latency_info_) {
+ latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1);
+ }
+
// We use WeakPtr here to avoid manual management of life time of an instance
// 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
@@ -228,9 +239,11 @@ bool PassThroughImageTransportSurface::PostSubBuffer(
}
void PassThroughImageTransportSurface::SwapBuffersCallBack() {
- for (size_t i = 0; i < latency_info_.size(); i++) {
- latency_info_[i].AddLatencyNumber(
- ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
+ base::TimeTicks swap_ack_time = base::TimeTicks::Now();
+ for (auto& latency : latency_info_) {
+ latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
+ swap_ack_time, 1);
}
helper_->SwapBuffersCompleted(latency_info_);

Powered by Google App Engine
This is Rietveld 408576698