Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1085)

Unified Diff: content/test/content_test_suite.cc

Issue 1137453002: content: Pass IOSurface references using Mach IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, remove extra DCHECKs and fix reply port typo Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/test/content_test_suite.cc
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index 6a3610a46ac4a425edbc5b4891f2a03eb60ee8f2..949ff4d8352738b848351b59954ed2bf1ea4b66c 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -25,7 +25,11 @@
#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
#if !defined(OS_IOS)
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/mac/scoped_mach_port.h"
+#include "base/memory/scoped_ptr.h"
#include "base/test/mock_chrome_application_mac.h"
+#include "content/common/mac/io_surface_manager.h"
#endif
#endif
@@ -94,6 +98,32 @@ class TestSurfaceTextureManager : public SurfaceTextureManager {
};
#endif
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+class TestIOSurfaceManager : public IOSurfaceManager {
+ public:
+ // Overridden from IOSurfaceManager:
+ bool RegisterIOSurface(int io_surface_id,
+ int client_id,
+ IOSurfaceRef io_surface) override {
+ io_surfaces_.add(io_surface_id,
+ make_scoped_ptr(new base::mac::ScopedMachSendRight(
+ IOSurfaceCreateMachPort(io_surface))));
+ return true;
+ }
+ void UnregisterIOSurface(int io_surface_id, int client_id) override {
+ io_surfaces_.erase(io_surface_id);
+ }
+ IOSurfaceRef AcquireIOSurface(int io_surface_id) override {
+ return IOSurfaceLookupFromMachPort(io_surfaces_.get(io_surface_id)->get());
+ }
+
+ private:
+ using IOSurfaceMap =
+ base::ScopedPtrHashMap<int, scoped_ptr<base::mac::ScopedMachSendRight>>;
+ IOSurfaceMap io_surfaces_;
+};
+#endif
+
} // namespace
ContentTestSuite::ContentTestSuite(int argc, char** argv)
@@ -137,6 +167,9 @@ void ContentTestSuite::Initialize() {
#if defined(OS_ANDROID)
SurfaceTextureManager::InitInstance(new TestSurfaceTextureManager);
#endif
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ IOSurfaceManager::SetInstance(new TestIOSurfaceManager);
+#endif
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698