| Index: ui/gl/gl_fence_libsync.cc
|
| diff --git a/ui/gl/gl_fence_libsync.cc b/ui/gl/gl_fence_libsync.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..be8ff014f24f1e05a75e4b916322ba7b82e84bec
|
| --- /dev/null
|
| +++ b/ui/gl/gl_fence_libsync.cc
|
| @@ -0,0 +1,32 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/gl/gl_fence_libsync.h"
|
| +
|
| +#include "base/trace_event/trace_event.h"
|
| +#include "third_party/libsync/include/sync/sync.h"
|
| +
|
| +namespace gl {
|
| +
|
| +GLFenceLibsync::GLFenceLibsync(base::ScopedFD fd) : fd_(std::move(fd)) {}
|
| +
|
| +GLFenceLibsync::~GLFenceLibsync() {}
|
| +
|
| +bool GLFenceLibsync::HasCompleted() {
|
| + int rv = sync_wait(fd_.get(), 0);
|
| + PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv;
|
| + return !rv;
|
| +}
|
| +
|
| +void GLFenceLibsync::ClientWait() {
|
| + TRACE_EVENT0("gpu", "GLFenceLibsync::ClientWait");
|
| + int rv = sync_wait(fd_.get(), -1);
|
| + PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv;
|
| +}
|
| +
|
| +void GLFenceLibsync::ServerWait() {
|
| + ClientWait();
|
| +}
|
| +
|
| +} // namespace gl
|
|
|