| 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 "gpu/ipc/client/gpu_fence_impl_libsync.h" |
| 6 |
| 7 #include "third_party/libsync/include/sync/sync.h" |
| 8 |
| 9 namespace gpu { |
| 10 |
| 11 GpuFenceImplLibsync::GpuFenceImplLibsync(const base::FileDescriptor& fd) |
| 12 : fd_(fd.fd) {} |
| 13 |
| 14 GpuFenceImplLibsync::~GpuFenceImplLibsync() {} |
| 15 |
| 16 bool GpuFenceImplLibsync::IsSignaled() { |
| 17 int rv = sync_wait(fd_.get(), 0); |
| 18 PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv; |
| 19 return !rv; |
| 20 } |
| 21 |
| 22 bool GpuFenceImplLibsync::Wait(const base::TimeDelta& max_time) { |
| 23 int rv = sync_wait(fd_.get(), max_time.InMilliseconds()); |
| 24 PLOG_IF(ERROR, rv < 0) << "sync_wait failed: " << rv; |
| 25 return !rv; |
| 26 } |
| 27 |
| 28 gfx::GpuFenceHandle GpuFenceImplLibsync::GetHandle() const { |
| 29 gfx::GpuFenceHandle handle; |
| 30 handle.fd.fd = fd_.get(); |
| 31 handle.fd.auto_close = false; |
| 32 return handle; |
| 33 } |
| 34 |
| 35 } // namespace gpu |
| OLD | NEW |