Have Canvas use the IOSurfacePool to avoid repeatedly creating IOSurfaces. Radar: <rdar://problem/20044440>
Created attachment 248119 [details] Patch
Comment on attachment 248119 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248119&action=review > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:50 > + if (cachedSurface->contextSize() != contextSize) I thought you mentioned that this was slow. Did further testing invalidate that result? > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:162 > + // Release the graphics context and update the context size. Next time, the graphics context is no comma between time and the
Comment on attachment 248119 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248119&action=review >> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:50 >> + if (cachedSurface->contextSize() != contextSize) > > I thought you mentioned that this was slow. Did further testing invalidate that result? I was wrong, I had a bug and it was causing the slow down.
Created attachment 248180 [details] Patch
Comment on attachment 248180 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248180&action=review > Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h:52 > class ImageBufferData { > public: > ImageBufferData(); > + ~ImageBufferData(); Since all the data members are public, we should change this to a struct and remove all the "m_" prefixes. > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:46 > + std::unique_ptr<IOSurface> cachedSurface = IOSurfacePool::sharedPool().takeSurface(size, colorSpace); I suggest using auto here instead of std::unique_ptr<IOSurface>. > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:51 > + if (cachedSurface->contextSize() != contextSize) > + cachedSurface->setContextSize(contextSize); Why not put the == check inside setContextSize instead? > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:57 > + if (std::unique_ptr<IOSurface> cachedSurface = surfaceFromPool(size, size, colorSpace)) I suggest auto here instead of naming the type. > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:59 > return std::unique_ptr<IOSurface>(new IOSurface(size, colorSpace)); I suggest make_unique here. > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:64 > + if (std::unique_ptr<IOSurface> cachedSurface = surfaceFromPool(size, contextSize, colorSpace)) I suggest auto here instead of naming the type. > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:66 > return std::unique_ptr<IOSurface>(new IOSurface(size, contextSize, colorSpace)); I suggest make_unique here.
Comment on attachment 248180 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248180&action=review >> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:51 >> + cachedSurface->setContextSize(contextSize); > > Why not put the == check inside setContextSize instead? The cost of calling the setContextSize() method was showing on the performance test. Since setContextSize() is private, I could also mark it as inline and move the contextSize check to the method if you'd prefer.
Comment on attachment 248180 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248180&action=review >>> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:51 >>> + cachedSurface->setContextSize(contextSize); >> >> Why not put the == check inside setContextSize instead? > > The cost of calling the setContextSize() method was showing on the performance test. Since setContextSize() is private, I could also mark it as inline and move the contextSize check to the method if you'd prefer. Never mind, I tested again today and moving the check to setContextSize() did not affect the results on Canvas/reuse.html. I'll make this change.
Comment on attachment 248180 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248180&action=review >> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:59 >> return std::unique_ptr<IOSurface>(new IOSurface(size, colorSpace)); > > I suggest make_unique here. In order to use make_unique<>(), I would need to make the constructors public. However, we really don't want people to call these constructors directly as this would bypass the IOSurfacePool.
Created attachment 248207 [details] Patch
Created attachment 248208 [details] Patch
Comment on attachment 248208 [details] Patch Attachment 248208 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5132014336344064 Number of test failures exceeded the failure limit.
Created attachment 248211 [details] Archive of layout-test-results from ews100 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-mavericks Platform: Mac OS X 10.9.5
Comment on attachment 248208 [details] Patch Attachment 248208 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/4850539359633408 Number of test failures exceeded the failure limit.
Created attachment 248214 [details] Archive of layout-test-results from ews104 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Created attachment 248215 [details] Patch
Comment on attachment 248215 [details] Patch Clearing flags on attachment: 248215 Committed r181301: <http://trac.webkit.org/changeset/181301>
All reviewed patches have been landed. Closing bug.