Chromium Code Reviews| Index: gpu/ipc/service/image_transport_surface_overlay_mac.mm |
| diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm |
| index 1ced5d09fe883c99e9e6531bd40af9c9056e4e24..f68ffc4623f330d6ad10718606b4bce0f3ff9ea6 100644 |
| --- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm |
| +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm |
| @@ -182,10 +182,18 @@ gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffersInternal( |
| // While we could call GLFence::ClientWait, this performs a busy wait on |
| // Mac, leading to high CPU usage. Instead we poll with a 1ms delay. This |
| // should have minimal impact, as we will only hit this path when we are |
| - // more than one frame (16ms) behind. |
| - while (!previous_frame_fence_->HasCompleted()) { |
| + // more than one frame (16ms) behind. Note that on some platforms (10.9), |
| + // fences appear to sometimes get lost and will naver pass. Add a 32ms |
|
ccameron
2016/06/13 22:16:14
s/naver/never
ericrk
2016/06/13 22:23:14
Done.
|
| + // timout to prevent these situations from causing a GPU process hang. |
| + int timeout = 32; |
|
ccameron
2016/06/13 22:16:14
s/timeout/timeout_msec
ericrk
2016/06/13 22:23:14
Done.
|
| + while (!previous_frame_fence_->HasCompleted() && timeout > 0) { |
| + --timeout; |
| base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); |
| } |
| + if (!previous_frame_fence_->HasCompleted()) { |
| + // We timed out waiting for the above fence, just issue a glFinish. |
| + glFinish(); |
| + } |
| } |
| // Create a fence for the current frame's work and save the context. |