Index: content/app/content_main_runner.cc |
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc |
index 4c8dcbb99c45b9cf19b2637411e2253892f9d1d4..e275d6f3bfc6429c838aeaec841874c58fe0de8c 100644 |
--- a/content/app/content_main_runner.cc |
+++ b/content/app/content_main_runner.cc |
@@ -85,6 +85,7 @@ |
#if !defined(OS_IOS) |
#include "base/power_monitor/power_monitor_device_source.h" |
#include "content/browser/mach_broker_mac.h" |
+#include "content/common/mac/io_surface_manager.h" |
#include "content/common/sandbox_init_mac.h" |
#endif // !OS_IOS |
#endif // OS_WIN |
@@ -125,6 +126,34 @@ extern int UtilityMain(const MainFunctionParams&); |
} // namespace content |
namespace content { |
+namespace { |
+ |
+#if defined(OS_MACOSX) && !defined(OS_IOS) |
+class IOSurfaceManagerImpl : public IOSurfaceManager { |
Avi (use Gerrit)
2015/05/09 18:00:27
If the MachBroker is basically backing this, put t
reveman
2015/05/09 19:24:23
Ok, I can move this code to mach_broker_mac.cc. Ju
Avi (use Gerrit)
2015/05/09 20:41:01
Then maybe its own file? It just feels weird to be
reveman
2015/05/10 18:45:08
Moved it to mach_broker_mac.cc in latest patch. I
|
+ public: |
+ IOSurfaceManagerImpl() {} |
+ |
+ // Overridden from IOSurfaceManager: |
+ bool RegisterIOSurface(int io_surface_id, |
+ int client_id, |
+ IOSurfaceRef io_surface) override { |
+ return MachBroker::ChildRegisterIOSurfaceWithParent( |
+ io_surface_id, client_id, IOSurfaceCreateMachPort(io_surface)); |
+ } |
+ void UnregisterIOSurface(int io_surface_id, int client_id) override { |
+ MachBroker::ChildUnregisterIOSurfaceWithParent(io_surface_id, client_id); |
+ } |
+ IOSurfaceRef AcquireIOSurface(int io_surface_id) override { |
+ return IOSurfaceLookupFromMachPort( |
+ MachBroker::ChildAcquireIOSurfaceFromParent(io_surface_id)); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(IOSurfaceManagerImpl); |
+}; |
+#endif |
+ |
+} // namespace |
#if !defined(CHROME_MULTIPLE_DLL_CHILD) |
base::LazyInstance<ContentBrowserClient> |
@@ -661,6 +690,8 @@ class ContentMainRunnerImpl : public ContentMainRunner { |
(!delegate_ || delegate_->ShouldSendMachPort(process_type))) { |
MachBroker::ChildSendTaskPortToParent(); |
} |
+ |
+ IOSurfaceManager::InitInstance(new IOSurfaceManagerImpl); |
#elif defined(OS_WIN) |
SetupCRT(command_line); |
#endif |