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..0299e9790904d02d48f87d9ccf6d47e1d35e2a59 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. |
Daniele Castagna
2015/05/08 18:58:30
What happens if it doesn't succeed? Does it return
reveman
2015/05/09 15:54:54
Yes, added this to the comment.
|
+ static mach_port_t ChildAcquireIOSurfaceFromParent(int io_surface_id); |
+ |
// 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, |
Daniele Castagna
2015/05/08 18:58:30
Are there annotations used in chromium for suggest
reveman
2015/05/09 15:54:54
No, that that I know. That'd be nice but I'm afrai
|
+ 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). |
+ 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 |