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

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

Issue 797843005: Add support to delay sending SwapbufferAck as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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') | ui/gl/gl_surface.h » ('j') | 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 f4c5a68cb218b02b354c2612ec7f3b18b4e89b63..8d2747c8952a4e6385722f52bf1711574bf79212 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -213,21 +213,20 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
// GetVsyncValues before SwapBuffers to work around Mali driver bug:
// crbug.com/223558.
SendVSyncUpdateIfAvailable();
- bool result = gfx::GLSurfaceAdapter::SwapBuffers();
- for (size_t i = 0; i < latency_info_.size(); i++) {
- latency_info_[i].AddLatencyNumber(
- ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
- }
-
- helper_->SwapBuffersCompleted(latency_info_);
- latency_info_.clear();
- return result;
+ return gfx::GLSurfaceAdapter::SwapBuffersAsync(
+ base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack,
+ base::Unretained(this)));
piman 2014/12/19 04:10:36 Why is Unretained safe? Can you add a comment?
kalyank 2014/12/19 08:43:03 Weakptr has a requirement that the callback be pos
piman 2014/12/19 20:32:54 Right, that's a strong requirement. It wouldn't be
}
bool PassThroughImageTransportSurface::PostSubBuffer(
int x, int y, int width, int height) {
SendVSyncUpdateIfAvailable();
- bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height);
+ return gfx::GLSurfaceAdapter::PostSubBufferAsync(x, y, width, height,
+ base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack,
+ base::Unretained(this)));
piman 2014/12/19 04:10:36 same thing here wrt Unretained.
+}
+
+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);
@@ -235,7 +234,6 @@ bool PassThroughImageTransportSurface::PostSubBuffer(
helper_->SwapBuffersCompleted(latency_info_);
latency_info_.clear();
- return result;
}
bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698