Chromium Code Reviews| Index: content/browser/mach_broker_mac.h |
| diff --git a/content/browser/mach_broker_mac.h b/content/browser/mach_broker_mac.h |
| index fb9f3efbf17b4dca105e4d683993ad368a72d4f7..9253527bb438bf889d2731fb5325bb9bf0b165a7 100644 |
| --- a/content/browser/mach_broker_mac.h |
| +++ b/content/browser/mach_broker_mac.h |
| @@ -44,6 +44,20 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, |
| // and false if otherwise. |
| static bool ChildSendTaskPortToParent(); |
| + // Register an IO surface for use in child process with |client_id|. |
| + static bool ChildRegisterIOSurfaceWithParent(int io_surface_id, |
| + int client_id, |
| + mach_port_t io_surface_port); |
| + |
| + // Unregister an IO surface. |
| + static bool ChildUnregisterIOSurfaceWithParent(int io_surface_id, |
| + int client_id); |
| + |
| + // Acquire IO surface reference for a registered IO surface. This will only |
| + // succeed if the IO surface has been registered for use in the current |
| + // process. |
| + static mach_port_t ChildAcquireIOSurfaceFromParent(int io_surface_id); |
| + |
|
Avi (use Gerrit)
2015/05/09 18:00:28
You might as well keep these private and have Mach
|
| // Returns the global MachBroker. |
| static MachBroker* GetInstance(); |
| @@ -61,7 +75,9 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, |
| // Callers are expected to later update the port with FinalizePid(). Callers |
| // MUST acquire the lock given by GetLock() before calling this method (and |
| // release the lock afterwards). |
| - void AddPlaceholderForPid(base::ProcessHandle pid, int child_process_id); |
| + void AddPlaceholderForPid(base::ProcessHandle pid, |
| + int child_process_id, |
| + bool is_gpu_process); |
| // Implement |ProcessMetrics::PortProvider|. |
| mach_port_t TaskForPid(base::ProcessHandle process) const override; |
| @@ -94,9 +110,26 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, |
| // Removes all mappings belonging to |child_process_id| from the broker. |
| void InvalidateChildProcessId(int child_process_id); |
| - // Returns the Mach port name to use when sending or receiving messages. |
| - // Does the Right Thing in the browser and in child processes. |
| - static std::string GetMachPortName(); |
| + // Register an IO surface for use in child process with |client_id|. |
| + // Callers MUST acquire the lock given by GetLock() before calling this |
| + // method (and release the lock afterwards). |
| + bool RegisterIOSurface(base::ProcessHandle pid, |
| + int io_surface_id, |
| + int client_id, |
| + mach_port_t io_surface_port); |
| + |
| + // Unregister an IO surface. Callers MUST acquire the lock given by GetLock() |
| + // before calling this method (and release the lock afterwards). |
| + void UnregisterIOSurface(base::ProcessHandle pid, |
| + int io_surface_id, |
| + int client_id); |
| + |
| + // Acquire IO surface reference for a registered IO surface. This will |
| + // only succeed if the IO surface is registered for use in |pid|. Callers |
| + // MUST acquire the lock given by GetLock() before calling this method |
| + // (and release the lock afterwards). Returns MACH_PORT_NULL on failure. |
| + mach_port_t AcquireIOSurface(base::ProcessHandle pid, int io_surface_id); |
| + |
| // Callback used to register notifications on the UI thread. |
| void RegisterNotifications(); |
| @@ -108,7 +141,16 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, |
| NotificationRegistrar registrar_; |
| // Stores mach info for every process in the broker. |
| - typedef std::map<base::ProcessHandle, mach_port_t> MachMap; |
| + struct MachPortSet { |
| + MachPortSet(); |
| + explicit MachPortSet(bool is_gpu_process); |
| + ~MachPortSet(); |
| + |
| + bool is_gpu_process; |
| + mach_port_t task_port; |
| + std::map<int, mach_port_t> io_surface_ports; |
| + }; |
| + typedef std::map<base::ProcessHandle, MachPortSet> MachMap; |
| MachMap mach_map_; |
| // Stores the Child process unique id (RenderProcessHost ID) for every |