| 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..e59934b4f6fa0d1ca4c20d3205ce53033c6a40fb 100644
|
| --- a/content/browser/mach_broker_mac.h
|
| +++ b/content/browser/mach_broker_mac.h
|
| @@ -38,11 +38,12 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider,
|
| public BrowserChildProcessObserver,
|
| public NotificationObserver {
|
| public:
|
| - // For use in child processes. This will send the task port of the current
|
| - // process over Mach IPC to the port registered by name (via this class) in
|
| - // the parent process. Returns true if the message was sent successfully
|
| - // and false if otherwise.
|
| - static bool ChildSendTaskPortToParent();
|
| + // For use in child processes. This will allocate Mach ports and send the
|
| + // task port of the current process over Mach IPC to the port registered by
|
| + // name (via this class) in the parent process. Returns true if Mach ports
|
| + // were successfully allocated and the task port successfully sent to the
|
| + // parent process.
|
| + static bool InitChildProcess();
|
|
|
| // Returns the global MachBroker.
|
| static MachBroker* GetInstance();
|
| @@ -61,7 +62,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,6 +97,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);
|
|
|
| + // 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);
|
| +
|
| // 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();
|
| @@ -108,7 +131,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
|
|
|