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

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: static_assert 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
« no previous file with comments | « content/content_tests.gypi ('k') | gpu/command_buffer/common/mailbox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/content_test_suite.cc
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index 57a2fbc5927893eca5745515d99aafe8058006cd..20db1eae1018f24570f61ca8bd4b9d166ea8a9b9 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -24,7 +24,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
@@ -95,6 +99,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)
@@ -138,6 +168,9 @@ void ContentTestSuite::Initialize() {
#if defined(OS_ANDROID)
SurfaceTextureManager::SetInstance(new TestSurfaceTextureManager);
#endif
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ IOSurfaceManager::SetInstance(new TestIOSurfaceManager);
+#endif
}
} // namespace content
« no previous file with comments | « content/content_tests.gypi ('k') | gpu/command_buffer/common/mailbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698