Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / common / mac / io_surface_manager.h
blob9dc36f0c32e34563ba9025afb179e8f25bec50f4
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"
13 namespace content {
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 {
22 public:
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,
28 int client_id,
29 IOSurfaceRef io_surface) = 0;
31 // Unregister an IO surface previously registered for use in another
32 // process.
33 virtual void UnregisterIOSurface(IOSurfaceId io_surface_id,
34 int client_id) = 0;
36 // Acquire IO surface reference for a registered IO surface.
37 virtual IOSurfaceRef AcquireIOSurface(IOSurfaceId io_surface_id) = 0;
39 protected:
40 virtual ~IOSurfaceManager() {}
43 } // namespace content
45 #endif // CONTENT_COMMON_MAC_IO_SURFACE_MANAGER_H_