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

Unified Diff: ui/gfx/mac/io_surface.h

Issue 1532813002: Replace IOSurfaceManager by directly passing IOSurface Mach ports over Chrome IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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/gfx/ipc/gfx_param_traits.cc ('k') | ui/gfx/mac/io_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/mac/io_surface.h
diff --git a/ui/gfx/mac/io_surface.h b/ui/gfx/mac/io_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c24fe4697cc09cc3e55bd3f81a157223a325636
--- /dev/null
+++ b/ui/gfx/mac/io_surface.h
@@ -0,0 +1,43 @@
+// Copyright 2015 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.
+
+#ifndef UI_GFX_MAC_IO_SURFACE_H_
+#define UI_GFX_MAC_IO_SURFACE_H_
+
+#include <IOSurface/IOSurface.h>
+#include <mach/mach.h>
+
+#include "base/mac/scoped_cftyperef.h"
+#include "ui/gfx/buffer_types.h"
+#include "ui/gfx/generic_shared_memory_id.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/gfx_export.h"
+
+namespace gfx {
+
+namespace internal {
+
+struct IOSurfaceMachPortTraits {
+ GFX_EXPORT static mach_port_t InvalidValue() { return MACH_PORT_NULL; }
+ GFX_EXPORT static mach_port_t Retain(mach_port_t);
+ GFX_EXPORT static void Release(mach_port_t);
+};
+
+} // namespace internal
+
+using IOSurfaceId = GenericSharedMemoryId;
+
+// Helper function to create an IOSurface with a specified size and format.
+GFX_EXPORT IOSurfaceRef CreateIOSurface(const Size& size, BufferFormat format);
+
+// A scoper for handling Mach port names that are send rights for IOSurfaces.
+// This scoper is both copyable and assignable, which will increase the kernel
+// reference count of the right. On destruction, the reference count is
+// decremented.
+using ScopedRefCountedIOSurfaceMachPort =
+ base::ScopedTypeRef<mach_port_t, internal::IOSurfaceMachPortTraits>;
+
+} // namespace gfx
+
+#endif // UI_GFX_MAC_IO_SURFACE_H_
« no previous file with comments | « ui/gfx/ipc/gfx_param_traits.cc ('k') | ui/gfx/mac/io_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698