Make WebCore::IOSurface have single ownership instead of refcounting
Created attachment 246551 [details] Patch
Comment on attachment 246551 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=246551&action=review Looks like most of the member variables of IOSurface can be const. > Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp:138 > + return WTF::move(surface); No need to use WTF::move here. > Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp:155 > + return WTF::move(surface); No need to use WTF::move here. > Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp:174 > + willAddSurface(surface.get(), surfaceIsInUse); Maybe this should take a reference. > Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp:210 > + std::unique_ptr<IOSurface> surface = m_inUseSurfaces.takeLast(); This should be auto. > Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp:224 > + std::unique_ptr<IOSurface> surface = surfaceQueueIter->value.takeLast(); auto. > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:70 > + std::unique_ptr<IOSurface> surface = IOSurface::create(IntSize(width, height), ColorSpaceDeviceRGB); auto. > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:75 > + return WTF::move(surface); No need to use WTF::move here. > Source/WebKit2/UIProcess/API/mac/WKView.mm:3229 > + std::unique_ptr<IOSurface> surface = IOSurface::createFromImage(croppedSnapshotImage.get()); auto! > Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm:137 > +PassRefPtr<ViewSnapshot> ViewSnapshot::create(std::unique_ptr<IOSurface> surface) This should return a Ref. > Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm:161 > +#if USE_IOSURFACE_VIEW_SNAPSHOTS > + m_imageSizeInBytes = m_surface->totalBytes(); > + m_size = m_surface->size(); > +#endif These can be member initializers.
http://trac.webkit.org/changeset/180088
And a build fix: http://trac.webkit.org/changeset/180089