gpu_fence_handle.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2017 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. #ifndef UI_GFX_GPU_FENCE_HANDLE_H_
  5. #define UI_GFX_GPU_FENCE_HANDLE_H_
  6. #include "build/build_config.h"
  7. #include "ui/gfx/gfx_export.h"
  8. #if BUILDFLAG(IS_POSIX)
  9. #include "base/files/scoped_file.h"
  10. #endif
  11. #if BUILDFLAG(IS_FUCHSIA)
  12. #include <lib/zx/event.h>
  13. #endif
  14. #if BUILDFLAG(IS_WIN)
  15. #include "base/win/scoped_handle.h"
  16. #endif
  17. namespace gfx {
  18. struct GFX_EXPORT GpuFenceHandle {
  19. GpuFenceHandle(const GpuFenceHandle&) = delete;
  20. GpuFenceHandle& operator=(const GpuFenceHandle&) = delete;
  21. GpuFenceHandle();
  22. GpuFenceHandle(GpuFenceHandle&& other);
  23. GpuFenceHandle& operator=(GpuFenceHandle&& other);
  24. ~GpuFenceHandle();
  25. bool is_null() const;
  26. // Returns an instance of |handle| which can be sent over IPC. This duplicates
  27. // the handle so that IPC code can take ownership of it without invalidating
  28. // |handle| itself.
  29. GpuFenceHandle Clone() const;
  30. // TODO(crbug.com/1142962): Make this a class instead of struct.
  31. #if BUILDFLAG(IS_POSIX)
  32. base::ScopedFD owned_fd;
  33. #elif BUILDFLAG(IS_FUCHSIA)
  34. zx::event owned_event;
  35. #elif BUILDFLAG(IS_WIN)
  36. base::win::ScopedHandle owned_handle;
  37. #endif
  38. };
  39. } // namespace gfx
  40. #endif // UI_GFX_GPU_FENCE_HANDLE_H_