1 // Copyright 2015 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.
5 #ifndef CONTENT_COMMON_MAC_IO_SURFACE_MANAGER_H_
6 #define CONTENT_COMMON_MAC_IO_SURFACE_MANAGER_H_
8 #include <IOSurface/IOSurface.h>
10 #include "content/common/content_export.h"
11 #include "ui/gfx/generic_shared_memory_id.h"
15 using IOSurfaceId
= gfx::GenericSharedMemoryId
;
17 // This interface provides a mechanism for different processes to securely
18 // share IOSurfaces. A process can register an IOSurface for use in another
19 // process and the client ID provided with registration determines the process
20 // that can acquire a reference to the IOSurface.
21 class CONTENT_EXPORT IOSurfaceManager
{
23 static IOSurfaceManager
* GetInstance();
24 static void SetInstance(IOSurfaceManager
* instance
);
26 // Register an IO surface for use in another process.
27 virtual bool RegisterIOSurface(IOSurfaceId io_surface_id
,
29 IOSurfaceRef io_surface
) = 0;
31 // Unregister an IO surface previously registered for use in another
33 virtual void UnregisterIOSurface(IOSurfaceId io_surface_id
,
36 // Acquire IO surface reference for a registered IO surface.
37 virtual IOSurfaceRef
AcquireIOSurface(IOSurfaceId io_surface_id
) = 0;
40 virtual ~IOSurfaceManager() {}
43 } // namespace content
45 #endif // CONTENT_COMMON_MAC_IO_SURFACE_MANAGER_H_