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

Unified Diff: ui/gl/io_surface_support_mac.cc

Issue 100053005: Allow AllocateGpuMemoryBuffer to be called from multiple threads. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « ui/gl/io_surface_support_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/io_surface_support_mac.cc
diff --git a/ui/gl/io_surface_support_mac.cc b/ui/gl/io_surface_support_mac.cc
index a7aeae85f8e5ca828aed8e15520041787dd09ff3..34b922d3840f1d3bbd4688cac14ffb73d5386894 100644
--- a/ui/gl/io_surface_support_mac.cc
+++ b/ui/gl/io_surface_support_mac.cc
@@ -22,6 +22,9 @@ typedef IOReturn (*IOSurfaceLockPtr)(CFTypeRef io_surface,
typedef IOReturn (*IOSurfaceUnlockPtr)(CFTypeRef io_surface,
uint32 options,
uint32* seed);
+typedef void (*IOSurfaceDecrementUseCountPtr)(CFTypeRef io_surface);
+typedef void (*IOSurfaceIncrementUseCountPtr)(CFTypeRef io_surface);
+typedef Boolean (*IOSurfaceIsInUsePtr)(CFTypeRef io_surface);
typedef CGLError (*CGLTexImageIOSurface2DProcPtr)(CGLContextObj ctx,
GLenum target,
@@ -67,6 +70,10 @@ class IOSurfaceSupportImpl : public IOSurfaceSupport {
uint32 options,
uint32* seed) OVERRIDE;
+ virtual void IOSurfaceDecrementUseCount(CFTypeRef io_surface) OVERRIDE;
+ virtual void IOSurfaceIncrementUseCount(CFTypeRef io_surface) OVERRIDE;
+ virtual Boolean IOSurfaceIsInUse(CFTypeRef io_surface) OVERRIDE;
+
virtual CGLError CGLTexImageIOSurface2D(CGLContextObj ctx,
GLenum target,
GLenum internal_format,
@@ -105,6 +112,10 @@ class IOSurfaceSupportImpl : public IOSurfaceSupport {
IOSurfaceGetBaseAddressPtr io_surface_get_base_address_;
IOSurfaceLockPtr io_surface_lock_;
IOSurfaceUnlockPtr io_surface_unlock_;
+ IOSurfaceDecrementUseCountPtr io_surface_decrement_use_count_;
+ IOSurfaceIncrementUseCountPtr io_surface_increment_use_count_;
+ IOSurfaceIsInUsePtr io_surface_is_in_use_;
+
CGLTexImageIOSurface2DProcPtr cgl_tex_image_io_surface_2d_;
CVPixelBufferGetIOSurfaceProcPtr cv_pixel_buffer_get_io_surface_;
bool initialized_successfully_;
@@ -190,6 +201,19 @@ IOReturn IOSurfaceSupportImpl::IOSurfaceUnlock(CFTypeRef io_surface,
return io_surface_unlock_(io_surface, options, seed);
}
+void IOSurfaceSupportImpl::IOSurfaceDecrementUseCount(CFTypeRef io_surface) {
+ io_surface_decrement_use_count_(io_surface);
+}
+
+void IOSurfaceSupportImpl::IOSurfaceIncrementUseCount(CFTypeRef io_surface) {
+ io_surface_increment_use_count_(io_surface);
+}
+
+Boolean IOSurfaceSupportImpl::IOSurfaceIsInUse(CFTypeRef io_surface) {
+ return io_surface_is_in_use_(io_surface);
+}
+
+
CGLError IOSurfaceSupportImpl::CGLTexImageIOSurface2D(CGLContextObj ctx,
GLenum target,
GLenum internal_format,
@@ -235,6 +259,9 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
io_surface_get_base_address_(NULL),
io_surface_lock_(NULL),
io_surface_unlock_(NULL),
+ io_surface_decrement_use_count_(NULL),
+ io_surface_increment_use_count_(NULL),
+ io_surface_is_in_use_(NULL),
cgl_tex_image_io_surface_2d_(NULL),
cv_pixel_buffer_get_io_surface_(NULL),
initialized_successfully_(false) {
@@ -279,6 +306,13 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
dlsym(iosurface_handle_, "IOSurfaceGetBaseAddress");
void* io_surface_lock_ptr = dlsym(iosurface_handle_, "IOSurfaceLock");
void* io_surface_unlock_ptr = dlsym(iosurface_handle_, "IOSurfaceUnlock");
+ void* io_surface_decrement_use_count_ptr =
+ dlsym(iosurface_handle_, "IOSurfaceDecrementUseCount");
+ void* io_surface_increment_use_count_ptr =
+ dlsym(iosurface_handle_, "IOSurfaceIncrementUseCount");
+ void* io_surface_is_in_use_ptr =
+ dlsym(iosurface_handle_, "IOSurfaceIsInUse");
+
void* tex_image_io_surface_2d_ptr =
dlsym(opengl_handle_, "CGLTexImageIOSurface2D");
void* cv_pixel_buffer_get_io_surface =
@@ -299,6 +333,9 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
!io_surface_get_base_address_ptr ||
!io_surface_lock_ptr ||
!io_surface_unlock_ptr ||
+ !io_surface_decrement_use_count_ptr ||
+ !io_surface_increment_use_count_ptr ||
+ !io_surface_is_in_use_ptr ||
!tex_image_io_surface_2d_ptr ||
!cv_pixel_buffer_get_io_surface) {
CloseLibraryHandles();
@@ -339,6 +376,14 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
io_surface_lock_ = reinterpret_cast<IOSurfaceLockPtr>(io_surface_lock_ptr);
io_surface_unlock_ = reinterpret_cast<IOSurfaceUnlockPtr>(
io_surface_unlock_ptr);
+ io_surface_decrement_use_count_ =
+ reinterpret_cast<IOSurfaceDecrementUseCountPtr>(
+ io_surface_decrement_use_count_ptr);
+ io_surface_increment_use_count_ =
+ reinterpret_cast<IOSurfaceIncrementUseCountPtr>(
+ io_surface_increment_use_count_ptr);
+ io_surface_is_in_use_ =
+ reinterpret_cast<IOSurfaceIsInUsePtr>(io_surface_is_in_use_ptr);
cgl_tex_image_io_surface_2d_ =
reinterpret_cast<CGLTexImageIOSurface2DProcPtr>(
tex_image_io_surface_2d_ptr);
« no previous file with comments | « ui/gl/io_surface_support_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698