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

Unified Diff: base/mac/scoped_mach_port.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: Fix Windows compile Created 5 years 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: base/mac/scoped_mach_port.h
diff --git a/base/mac/scoped_mach_port.h b/base/mac/scoped_mach_port.h
index 67fed6bcfd87769ec639337c890e3654c76426ab..c462663acf722ba6df7792b5873ed9fb8c158a16 100644
--- a/base/mac/scoped_mach_port.h
+++ b/base/mac/scoped_mach_port.h
@@ -8,6 +8,7 @@
#include <mach/mach.h>
#include "base/base_export.h"
+#include "base/mac/scoped_typeref.h"
#include "base/scoped_generic.h"
namespace base {
@@ -39,6 +40,11 @@ struct PortSetTraits {
BASE_EXPORT static void Free(mach_port_t port);
};
+struct RefCountedSendRighTraits {
+ BASE_EXPORT static void Retain(mach_port_t);
+ BASE_EXPORT static void Release(mach_port_t);
+};
+
} // namespace internal
// A scoper for handling a Mach port that names a send right. Send rights are
@@ -61,6 +67,13 @@ using ScopedMachReceiveRight =
// the receive rights that are members of the port set.
using ScopedMachPortSet = ScopedGeneric<mach_port_t, internal::PortSetTraits>;
+// A scoper for handling Mach port names that are send rights. Unlike
+// ScopedMachSendRight, this scoper is both copyable and assignable, which will
+// increase the kernel reference count of the right. Otherwise, this behaves
+// the same as ScopedMachSendRight.
+using ScopedRefCountedMachSendRight =
+ ScopedTypeRef<mach_port_t, internal::RefCountedSendRighTraits>;
+
} // namespace mac
} // namespace base
« no previous file with comments | « no previous file | base/mac/scoped_mach_port.cc » ('j') | content/common/gpu/gpu_memory_buffer_factory_io_surface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698