| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/gl/gl_fence_libsync.h" |
| 6 |
| 7 #include "base/trace_event/trace_event.h" |
| 8 #include "third_party/libsync/include/sync/sync.h" |
| 9 |
| 10 namespace gl { |
| 11 |
| 12 GLFenceLibsync::GLFenceLibsync(base::ScopedFD fd) : fd_(std::move(fd)) {} |
| 13 |
| 14 GLFenceLibsync::~GLFenceLibsync() {} |
| 15 |
| 16 bool GLFenceLibsync::HasCompleted() { |
| 17 int rv = sync_wait(fd_.get(), 0); |
| 18 PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv; |
| 19 return !rv; |
| 20 } |
| 21 |
| 22 void GLFenceLibsync::ClientWait() { |
| 23 TRACE_EVENT0("gpu", "GLFenceLibsync::ClientWait"); |
| 24 int rv = sync_wait(fd_.get(), -1); |
| 25 PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv; |
| 26 } |
| 27 |
| 28 void GLFenceLibsync::ServerWait() { |
| 29 ClientWait(); |
| 30 } |
| 31 |
| 32 } // namespace gl |
| OLD | NEW |