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_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
| 6 #define CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
| 7 |
| 8 #include "base/mac/scoped_mach_port.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/singleton.h" |
| 11 #include "content/common/mac/io_surface_manager.h" |
| 12 #include "content/common/mac/io_surface_manager_token.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // Implementation of IOSurfaceManager that registers and acquires IOSurfaces |
| 17 // through a Mach service. |
| 18 class CONTENT_EXPORT ChildIOSurfaceManager : public IOSurfaceManager { |
| 19 public: |
| 20 // Returns the global ChildIOSurfaceManager. |
| 21 static ChildIOSurfaceManager* GetInstance(); |
| 22 |
| 23 // Overridden from IOSurfaceManager: |
| 24 bool RegisterIOSurface(int io_surface_id, |
| 25 int client_id, |
| 26 IOSurfaceRef io_surface) override; |
| 27 void UnregisterIOSurface(int io_surface_id, int client_id) override; |
| 28 IOSurfaceRef AcquireIOSurface(int io_surface_id) override; |
| 29 |
| 30 // Set the service Mach port. Ownership of |service_port| is passed to the |
| 31 // manager. |
| 32 void set_service_port(mach_port_t service_port) { |
| 33 service_port_.reset(service_port); |
| 34 } |
| 35 |
| 36 // Set the token used when communicating with the Mach service. |
| 37 void set_token(const IOSurfaceManagerToken& token) { token_ = token; } |
| 38 |
| 39 private: |
| 40 friend struct DefaultSingletonTraits<ChildIOSurfaceManager>; |
| 41 |
| 42 ChildIOSurfaceManager(); |
| 43 ~ChildIOSurfaceManager() override; |
| 44 |
| 45 base::mac::ScopedMachSendRight service_port_; |
| 46 IOSurfaceManagerToken token_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(ChildIOSurfaceManager); |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
OLD | NEW |