Allow more buffer formats in the IOSurface pool
[WebKit-https.git] / Source / WebCore / platform / graphics / cg / IOSurfacePool.h
index cf83b821f345b191410cfa871094d351b54689c5..1e172b4799478a07a351863f8d9c1f599e2826a0 100644 (file)
@@ -27,6 +27,7 @@
 #define IOSurfacePool_h
 
 #include "ColorSpace.h"
+#include "IOSurface.h"
 #include "IntSize.h"
 #include "IntSizeHash.h"
 #include "Timer.h"
@@ -39,8 +40,6 @@
 
 namespace WebCore {
 
-class IOSurface;
-
 class IOSurfacePool {
     WTF_MAKE_NONCOPYABLE(IOSurfacePool);
     WTF_MAKE_FAST_ALLOCATED;
@@ -49,7 +48,7 @@ class IOSurfacePool {
 public:
     WEBCORE_EXPORT static IOSurfacePool& sharedPool();
 
-    std::unique_ptr<IOSurface> takeSurface(IntSize, ColorSpace);
+    std::unique_ptr<IOSurface> takeSurface(IntSize, ColorSpace, IOSurface::Format);
     WEBCORE_EXPORT void addSurface(std::unique_ptr<IOSurface>);
 
     void discardAllSurfaces();
@@ -75,6 +74,8 @@ private:
     typedef Deque<std::unique_ptr<IOSurface>> CachedSurfaceQueue;
     typedef HashMap<IntSize, CachedSurfaceQueue> CachedSurfaceMap;
     typedef HashMap<IOSurface*, CachedSurfaceDetails> CachedSurfaceDetailsMap;
+    
+    bool shouldCacheSurface(const IOSurface&) const;
 
     void willAddSurface(IOSurface&, bool inUse);
     void didRemoveSurface(IOSurface&, bool inUse);