Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Unified Diff: ui/gl/gl_fence_libsync.cc

Issue 2384243003: ui: Add libsync GLFence implementation.
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_fence_libsync.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/gl/gl_fence_libsync.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698