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

Side by Side Diff: content/common/gpu/image_transport_surface.cc

Issue 1084173004: Adding status to swap complete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/image_transport_surface.h" 5 #include "content/common/gpu/image_transport_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 // We use WeakPtr here to avoid manual management of life time of an instance 220 // We use WeakPtr here to avoid manual management of life time of an instance
221 // of this class. Callback will not be called once the instance of this class 221 // of this class. Callback will not be called once the instance of this class
222 // is destroyed. However, this also means that the callback can be run on 222 // is destroyed. However, this also means that the callback can be run on
223 // the calling thread only. 223 // the calling thread only.
224 return gfx::GLSurfaceAdapter::PostSubBufferAsync(x, y, width, height, 224 return gfx::GLSurfaceAdapter::PostSubBufferAsync(x, y, width, height,
225 base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, 225 base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack,
226 weak_ptr_factory_.GetWeakPtr())); 226 weak_ptr_factory_.GetWeakPtr()));
227 } 227 }
228 228
229 void PassThroughImageTransportSurface::SwapBuffersCallBack() { 229 void PassThroughImageTransportSurface::SwapBuffersCallBack(
230 gfx::SwapResult result) {
230 base::TimeTicks swap_ack_time = base::TimeTicks::Now(); 231 base::TimeTicks swap_ack_time = base::TimeTicks::Now();
231 for (auto& latency : latency_info_) { 232 for (auto& latency : latency_info_) {
232 latency.AddLatencyNumberWithTimestamp( 233 latency.AddLatencyNumberWithTimestamp(
233 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, 234 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
234 swap_ack_time, 1); 235 swap_ack_time, 1);
235 } 236 }
236 237
237 helper_->stub()->SendSwapBuffersCompleted(latency_info_); 238 helper_->stub()->SendSwapBuffersCompleted(latency_info_, result);
238 latency_info_.clear(); 239 latency_info_.clear();
239 } 240 }
240 241
241 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { 242 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
242 if (!did_set_swap_interval_) { 243 if (!did_set_swap_interval_) {
243 ImageTransportHelper::SetSwapInterval(context); 244 ImageTransportHelper::SetSwapInterval(context);
244 did_set_swap_interval_ = true; 245 did_set_swap_interval_ = true;
245 } 246 }
246 return true; 247 return true;
247 } 248 }
(...skipping 23 matching lines...) Expand all
271 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 272 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
272 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 273 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
273 if (vsync_provider) { 274 if (vsync_provider) {
274 vsync_provider->GetVSyncParameters( 275 vsync_provider->GetVSyncParameters(
275 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters, 276 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters,
276 helper_->stub()->AsWeakPtr())); 277 helper_->stub()->AsWeakPtr()));
277 } 278 }
278 } 279 }
279 280
280 } // namespace content 281 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698