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

Side by Side 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 unified diff | Download patch
OLDNEW
(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.h"
6
7 #include "base/logging.h"
8 #include "build/build_config.h"
9
10 namespace gpu {
11
12 GpuFenceImpl::GpuFenceImpl() {}
13
14 GpuFenceImpl::GpuFenceImpl(const gfx::GpuFenceHandle& handle)
15 : shared_event_(handle.shared_event_handle) {}
16
17 GpuFenceImpl::~GpuFenceImpl() {}
18
19 // static
20 gfx::GpuFenceHandle GpuFenceImpl::CreateForChildProcess(
21 base::ProcessHandle child_process) {
22 gfx::GpuFenceHandle handle;
23 handle.shared_event_handle =
24 gfx::SharedEvent::CreateForProcess(child_process);
25 return handle;
26 }
27
28 // static
29 GpuFenceImpl* GpuFenceImpl::FromClientFence(ClientFence fence) {
30 return reinterpret_cast<GpuFenceImpl*>(fence);
31 }
32
33 bool GpuFenceImpl::IsSignaled() {
34 return shared_event_.IsSignaled();
35 }
36
37 bool GpuFenceImpl::Wait(const base::TimeDelta& max_time) {
38 return shared_event_.Wait(max_time);
39 }
40
41 void GpuFenceImpl::Reset() {
42 return shared_event_.Reset();
43 }
44
45 gfx::GpuFenceHandle GpuFenceImpl::GetHandle() const {
46 gfx::GpuFenceHandle handle;
47 handle.shared_event_handle = shared_event_.GetHandle();
48 return handle;
49 }
50
51 ClientFence GpuFenceImpl::AsClientFence() {
52 return reinterpret_cast<ClientFence>(this);
53 }
54
55 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698