OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 #ifndef CHROME_COMMON_IO_SURFACE_SUPPORT_MAC_H_ |
| 6 #define CHROME_COMMON_IO_SURFACE_SUPPORT_MAC_H_ |
| 7 |
| 8 #include <CoreFoundation/CoreFoundation.h> |
| 9 #include <mach/mach.h> |
| 10 #include <OpenGL/OpenGL.h> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 |
| 14 // This Mac OS X-specific class provides dynamically-linked access to |
| 15 // IOSurface.framework, which is only available on 10.6 and later. |
| 16 // Since Chromium is built on 10.5 we must dynamically look up all of |
| 17 // the entry points we need in this framework. |
| 18 |
| 19 // See IOSurface/IOSurfaceAPI.h and OpenGL/CGLIOSurface.h on 10.6 for |
| 20 // documentation of the fields and methods of this class. |
| 21 |
| 22 class IOSurfaceSupport { |
| 23 public: |
| 24 // Returns an instance of the IOSurfaceSupport class if the |
| 25 // operating system supports it, NULL otherwise. It is safe to call |
| 26 // this multiple times. |
| 27 static IOSurfaceSupport* Initialize(); |
| 28 |
| 29 virtual CFStringRef GetKIOSurfaceWidth() = 0; |
| 30 virtual CFStringRef GetKIOSurfaceHeight() = 0; |
| 31 virtual CFStringRef GetKIOSurfaceBytesPerElement() = 0; |
| 32 virtual CFStringRef GetKIOSurfaceIsGlobal() = 0; |
| 33 |
| 34 virtual CFTypeRef IOSurfaceCreate(CFDictionaryRef properties) = 0; |
| 35 |
| 36 // The following two APIs assume the IOSurface was created with the |
| 37 // kIOSurfaceIsGlobal key set to true |
| 38 virtual uint32 IOSurfaceGetID(CFTypeRef io_surface) = 0; |
| 39 virtual CFTypeRef IOSurfaceLookup(uint32 io_surface_id) = 0; |
| 40 |
| 41 // The following two APIs are more robust and secure, but |
| 42 // unfortunately it looks like it will be a lot of work to correctly |
| 43 // transmit a mach port from process to process (possibly requiring |
| 44 // a side channel for or extension of the Chrome IPC mechanism) |
| 45 virtual mach_port_t IOSurfaceCreateMachPort(CFTypeRef io_surface) = 0; |
| 46 virtual CFTypeRef IOSurfaceLookupFromMachPort(mach_port_t port) = 0; |
| 47 |
| 48 virtual CGLError CGLTexImageIOSurface2D(CGLContextObj ctx, |
| 49 GLenum target, |
| 50 GLenum internal_format, |
| 51 GLsizei width, |
| 52 GLsizei height, |
| 53 GLenum format, |
| 54 GLenum type, |
| 55 CFTypeRef io_surface, |
| 56 GLuint plane) = 0; |
| 57 |
| 58 protected: |
| 59 IOSurfaceSupport(); |
| 60 virtual ~IOSurfaceSupport(); |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(IOSurfaceSupport); |
| 63 }; |
| 64 |
| 65 #endif // CHROME_COMMON_IO_SURFACE_SUPPORT_MAC_H_ |
| 66 |
OLD | NEW |