OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_COMMON_MAC_IO_SURFACE_MANAGER_H_ | |
6 #define CONTENT_COMMON_MAC_IO_SURFACE_MANAGER_H_ | |
7 | |
8 #include <IOSurface/IOSurface.h> | |
9 | |
10 #include "ui/gfx/buffer_types.h" | |
11 #include "ui/gfx/generic_shared_memory_id.h" | |
12 #include "ui/gfx/geometry/size.h" | |
13 #include "ui/gfx/gfx_export.h" | |
14 | |
15 namespace gfx { | |
16 | |
17 using IOSurfaceId = GenericSharedMemoryId; | |
18 | |
19 // This interface provides a mechanism for different processes to securely | |
20 // share IOSurfaces. A process can register an IOSurface for use in another | |
21 // process and the client ID provided with registration determines the process | |
22 // that can acquire a reference to the IOSurface. | |
23 class GFX_EXPORT IOSurfaceManager { | |
24 public: | |
25 static IOSurfaceManager* GetInstance(); | |
26 static void SetInstance(IOSurfaceManager* instance); | |
27 | |
28 // Helper function to create an IOSurface with a specified size and format. | |
29 static IOSurfaceRef CreateIOSurface(const Size& size, BufferFormat format); | |
30 | |
31 // Register an IO surface for use in another process. | |
32 virtual bool RegisterIOSurface(IOSurfaceId io_surface_id, | |
33 int client_id, | |
34 IOSurfaceRef io_surface) = 0; | |
35 | |
36 // Unregister an IO surface previously registered for use in another | |
37 // process. | |
38 virtual void UnregisterIOSurface(IOSurfaceId io_surface_id, | |
39 int client_id) = 0; | |
40 | |
41 // Acquire IO surface reference for a registered IO surface. | |
42 virtual IOSurfaceRef AcquireIOSurface(IOSurfaceId io_surface_id) = 0; | |
43 | |
44 protected: | |
45 virtual ~IOSurfaceManager() {} | |
46 }; | |
47 | |
48 } // namespace content | |
49 | |
50 #endif // CONTENT_COMMON_MAC_IO_SURFACE_MANAGER_H_ | |
OLD | NEW |