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

Unified Diff: gpu/ipc/client/gpu_fence_impl.cc

Issue 2383753002: gpu: Add GpuFence framework.
Patch Set: rebase Created 4 years, 1 month 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
Index: gpu/ipc/client/gpu_fence_impl.cc
diff --git a/gpu/ipc/client/gpu_fence_impl.cc b/gpu/ipc/client/gpu_fence_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..722cf8e7188c4e5896d410dbf5cf973c6c29c7dc
--- /dev/null
+++ b/gpu/ipc/client/gpu_fence_impl.cc
@@ -0,0 +1,55 @@
+// 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.h"
+
+#include "base/logging.h"
+#include "build/build_config.h"
+
+namespace gpu {
+
+GpuFenceImpl::GpuFenceImpl() {}
+
+GpuFenceImpl::GpuFenceImpl(const gfx::GpuFenceHandle& handle)
+ : shared_event_(handle.shared_event_handle) {}
+
+GpuFenceImpl::~GpuFenceImpl() {}
+
+// static
+gfx::GpuFenceHandle GpuFenceImpl::CreateForChildProcess(
+ base::ProcessHandle child_process) {
+ gfx::GpuFenceHandle handle;
+ handle.shared_event_handle =
+ gfx::SharedEvent::CreateForProcess(child_process);
+ return handle;
+}
+
+// static
+GpuFenceImpl* GpuFenceImpl::FromClientFence(ClientFence fence) {
+ return reinterpret_cast<GpuFenceImpl*>(fence);
+}
+
+bool GpuFenceImpl::IsSignaled() {
+ return shared_event_.IsSignaled();
+}
+
+bool GpuFenceImpl::Wait(const base::TimeDelta& max_time) {
+ return shared_event_.Wait(max_time);
+}
+
+void GpuFenceImpl::Reset() {
+ return shared_event_.Reset();
+}
+
+gfx::GpuFenceHandle GpuFenceImpl::GetHandle() const {
+ gfx::GpuFenceHandle handle;
+ handle.shared_event_handle = shared_event_.GetHandle();
+ return handle;
+}
+
+ClientFence GpuFenceImpl::AsClientFence() {
+ return reinterpret_cast<ClientFence>(this);
+}
+
+} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698