OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ | 5 #ifndef CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
6 #define CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ | 6 #define CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
7 | 7 |
8 #include "base/mac/scoped_mach_port.h" | 8 #include "base/mac/scoped_mach_port.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/common/mac/io_surface_manager_token.h" | 12 #include "content/common/mac/io_surface_manager_token.h" |
13 #include "ui/gfx/mac/io_surface_manager.h" | 13 #include "ui/gfx/mac/io_surface_manager.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 // Implementation of IOSurfaceManager that registers and acquires IOSurfaces | 17 // Implementation of IOSurfaceManager that registers and acquires IOSurfaces |
18 // through a Mach service. | 18 // through a Mach service. |
19 class CONTENT_EXPORT ChildIOSurfaceManager : public gfx::IOSurfaceManager { | 19 class CONTENT_EXPORT ChildIOSurfaceManager : public gfx::IOSurfaceManager { |
20 public: | 20 public: |
21 // Returns the global ChildIOSurfaceManager. | 21 // Returns the global ChildIOSurfaceManager. |
22 static ChildIOSurfaceManager* GetInstance(); | 22 static ChildIOSurfaceManager* GetInstance(); |
23 | 23 |
24 // Overridden from IOSurfaceManager: | 24 // Overridden from IOSurfaceManager: |
25 bool RegisterIOSurface(gfx::IOSurfaceId io_surface_id, | 25 bool RegisterIOSurface(gfx::IOSurfaceId io_surface_id, |
26 int client_id, | 26 int client_id, |
27 IOSurfaceRef io_surface) override; | 27 IOSurfaceRef io_surface) override; |
28 void UnregisterIOSurface(gfx::IOSurfaceId io_surface_id, | 28 void UnregisterIOSurface(gfx::IOSurfaceId io_surface_id, |
29 int client_id) override; | 29 int client_id) override; |
30 | |
31 // This will always return a valid IOSurface (failure will crash). | |
reveman
2015/12/01 20:49:04
We need to be able to use this in the GPU process
| |
30 IOSurfaceRef AcquireIOSurface(gfx::IOSurfaceId io_surface_id) override; | 32 IOSurfaceRef AcquireIOSurface(gfx::IOSurfaceId io_surface_id) override; |
31 | 33 |
32 // Set the service Mach port. Ownership of |service_port| is passed to the | 34 // Set the service Mach port. Ownership of |service_port| is passed to the |
33 // manager. | 35 // manager. |
34 // Note: This can be called on any thread but must happen before the | 36 // Note: This can be called on any thread but must happen before the |
35 // thread-safe IOSurfaceManager interface is used. It is the responsibility | 37 // thread-safe IOSurfaceManager interface is used. It is the responsibility |
36 // of users of this class to ensure there are no races. | 38 // of users of this class to ensure there are no races. |
37 void set_service_port(mach_port_t service_port) { | 39 void set_service_port(mach_port_t service_port) { |
38 service_port_.reset(service_port); | 40 service_port_.reset(service_port); |
39 } | 41 } |
(...skipping 14 matching lines...) Expand all Loading... | |
54 | 56 |
55 base::mac::ScopedMachSendRight service_port_; | 57 base::mac::ScopedMachSendRight service_port_; |
56 IOSurfaceManagerToken token_; | 58 IOSurfaceManagerToken token_; |
57 | 59 |
58 DISALLOW_COPY_AND_ASSIGN(ChildIOSurfaceManager); | 60 DISALLOW_COPY_AND_ASSIGN(ChildIOSurfaceManager); |
59 }; | 61 }; |
60 | 62 |
61 } // namespace content | 63 } // namespace content |
62 | 64 |
63 #endif // CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ | 65 #endif // CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
OLD | NEW |