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_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_ |
6 #define CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_ | 6 #define CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_ |
7 | 7 |
8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/containers/scoped_ptr_hash_map.h" | 13 #include "base/containers/scoped_ptr_hash_map.h" |
14 #include "base/mac/dispatch_source_mach.h" | 14 #include "base/mac/dispatch_source_mach.h" |
15 #include "base/mac/scoped_mach_port.h" | 15 #include "base/mac/scoped_mach_port.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
21 #include "content/common/mac/io_surface_manager.h" | 21 #include "content/common/mac/io_surface_manager.h" |
22 #include "content/common/mac/io_surface_manager_messages.h" | 22 #include "content/common/mac/io_surface_manager_messages.h" |
23 #include "content/common/mac/io_surface_manager_token.h" | 23 #include "content/common/mac/io_surface_manager_token.h" |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
| 27 // TODO(ericrk): Use gfx::GenericSharedMemoryId as the |io_surface_id| in |
| 28 // this file. Allows for more type-safe usage of GpuMemoryBufferIds as the |
| 29 // type of the |io_surface_id|, as it is a typedef of |
| 30 // gfx::GenericSharedMemoryId. |
| 31 |
27 // Implementation of IOSurfaceManager that provides a mechanism for child | 32 // Implementation of IOSurfaceManager that provides a mechanism for child |
28 // processes to register and acquire IOSurfaces through a Mach service. | 33 // processes to register and acquire IOSurfaces through a Mach service. |
29 class CONTENT_EXPORT BrowserIOSurfaceManager : public IOSurfaceManager { | 34 class CONTENT_EXPORT BrowserIOSurfaceManager : public IOSurfaceManager { |
30 public: | 35 public: |
31 // Returns the global BrowserIOSurfaceManager. | 36 // Returns the global BrowserIOSurfaceManager. |
32 static BrowserIOSurfaceManager* GetInstance(); | 37 static BrowserIOSurfaceManager* GetInstance(); |
33 | 38 |
34 // Look up the IOSurfaceManager service port that's been registered with | 39 // Look up the IOSurfaceManager service port that's been registered with |
35 // the bootstrap server. |pid| is the process ID of the service. | 40 // the bootstrap server. |pid| is the process ID of the service. |
36 static base::mac::ScopedMachSendRight LookupServicePort(pid_t pid); | 41 static base::mac::ScopedMachSendRight LookupServicePort(pid_t pid); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Mutex that guards |initialized_|, |io_surfaces_|, |child_process_ids_| | 116 // Mutex that guards |initialized_|, |io_surfaces_|, |child_process_ids_| |
112 // and |gpu_process_token_|. | 117 // and |gpu_process_token_|. |
113 base::Lock lock_; | 118 base::Lock lock_; |
114 | 119 |
115 DISALLOW_COPY_AND_ASSIGN(BrowserIOSurfaceManager); | 120 DISALLOW_COPY_AND_ASSIGN(BrowserIOSurfaceManager); |
116 }; | 121 }; |
117 | 122 |
118 } // namespace content | 123 } // namespace content |
119 | 124 |
120 #endif // CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_ | 125 #endif // CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_ |
OLD | NEW |