| Index: gpu/ipc/client/gpu_fence_impl_libsync.cc
|
| diff --git a/gpu/ipc/client/gpu_fence_impl_libsync.cc b/gpu/ipc/client/gpu_fence_impl_libsync.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7f794912fcae43bc1902c2c40357f3e10851d9e7
|
| --- /dev/null
|
| +++ b/gpu/ipc/client/gpu_fence_impl_libsync.cc
|
| @@ -0,0 +1,35 @@
|
| +// 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 "gpu/ipc/client/gpu_fence_impl_libsync.h"
|
| +
|
| +#include "third_party/libsync/include/sync/sync.h"
|
| +
|
| +namespace gpu {
|
| +
|
| +GpuFenceImplLibsync::GpuFenceImplLibsync(const base::FileDescriptor& fd)
|
| + : fd_(fd.fd) {}
|
| +
|
| +GpuFenceImplLibsync::~GpuFenceImplLibsync() {}
|
| +
|
| +bool GpuFenceImplLibsync::IsSignaled() {
|
| + int rv = sync_wait(fd_.get(), 0);
|
| + PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv;
|
| + return !rv;
|
| +}
|
| +
|
| +bool GpuFenceImplLibsync::Wait(const base::TimeDelta& max_time) {
|
| + int rv = sync_wait(fd_.get(), max_time.InMilliseconds());
|
| + PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv;
|
| + return !rv;
|
| +}
|
| +
|
| +gfx::GpuFenceHandle GpuFenceImplLibsync::GetHandle() const {
|
| + gfx::GpuFenceHandle handle;
|
| + handle.fd.fd = fd_.get();
|
| + handle.fd.auto_close = false;
|
| + return handle;
|
| +}
|
| +
|
| +} // namespace gpu
|
|
|