Title: [192555] branches/safari-601.1.46-branch/Source

Diff

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (192554 => 192555)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-11-18 00:27:05 UTC (rev 192554)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-11-18 00:27:09 UTC (rev 192555)
@@ -1,5 +1,9 @@
 2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
 
+        Rollout r192419. rdar://problem/22846841
+
+2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
+
         Rollout r192479. rdar://problem/22846841
 
 2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
@@ -402,36 +406,6 @@
             (WebCore::WillChangeData::AnimatableFeature::AnimatableFeature):
             (WebCore::WillChangeData::AnimatableFeature::operator==):
 
-2015-11-12  Matthew Hanson  <matthew_han...@apple.com>
-
-        Merge r190574. rdar://problem/22846841
-
-    2015-10-05  Beth Dakin  <bda...@apple.com>
-
-            Compress snapshots on iOS
-            https://bugs.webkit.org/show_bug.cgi?id=149814
-            -and corresponding-
-            rdar://problem/22976230
-
-            Reviewed by Simon Fraser.
-
-            Though the default is still RGBA, it is now possible to create an IOSurface
-            that uses the YUV422 pixel format.
-            * platform/graphics/cocoa/IOSurface.h:
-            * platform/graphics/cocoa/IOSurface.mm:
-            (IOSurface::surfaceFromPool):
-            (IOSurface::create):
-            (IOSurface::createFromImage):
-            (IOSurface::IOSurface):
-            (IOSurface::releaseGraphicsContext):
-
-            In order to have a YUV IOSurface, we actually have to create an RGBA surface
-            first and then convert it to YUV, so this class method will handle that.
-            (IOSurface::convertToFormat):
-
-            Necessary SPI.
-            * platform/spi/cocoa/IOSurfaceSPI.h:
-
 2015-10-29  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r191706. rdar://problem/23319282

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h (192554 => 192555)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2015-11-18 00:27:05 UTC (rev 192554)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2015-11-18 00:27:09 UTC (rev 192555)
@@ -38,14 +38,7 @@
 
 class IOSurface final {
 public:
-    enum class Format {
-        RGBA,
-#if PLATFORM(IOS)
-        YUV422
-#endif
-    };
-
-    WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, ColorSpace, Format = Format::RGBA);
+    WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, ColorSpace);
     WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, IntSize contextSize, ColorSpace);
     WEBCORE_EXPORT static std::unique_ptr<IOSurface> createFromSendRight(const MachSendRight&, ColorSpace);
     static std::unique_ptr<IOSurface> createFromSurface(IOSurfaceRef, ColorSpace);
@@ -80,7 +73,6 @@
     IntSize size() const { return m_size; }
     size_t totalBytes() const { return m_totalBytes; }
     ColorSpace colorSpace() const { return m_colorSpace; }
-    Format format() const { return m_format; }
 
     WEBCORE_EXPORT bool isInUse() const;
 
@@ -88,12 +80,8 @@
     // an accurate result from isInUse(), it needs to be released.
     WEBCORE_EXPORT void releaseGraphicsContext();
 
-#if PLATFORM(IOS)
-    WEBCORE_EXPORT static void convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format, std::function<void(std::unique_ptr<WebCore::IOSurface>)>);
-#endif
-
 private:
-    IOSurface(IntSize, ColorSpace, Format);
+    IOSurface(IntSize, ColorSpace);
     IOSurface(IntSize, IntSize contextSize, ColorSpace);
     IOSurface(IOSurfaceRef, ColorSpace);
 
@@ -102,7 +90,6 @@
     void setContextSize(IntSize);
 
     ColorSpace m_colorSpace;
-    Format m_format;
     IntSize m_size;
     IntSize m_contextSize;
     size_t m_totalBytes;

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (192554 => 192555)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2015-11-18 00:27:05 UTC (rev 192554)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2015-11-18 00:27:09 UTC (rev 192555)
@@ -51,15 +51,11 @@
     return cachedSurface;
 }
 
-std::unique_ptr<IOSurface> IOSurface::create(IntSize size, ColorSpace colorSpace, Format pixelFormat)
+std::unique_ptr<IOSurface> IOSurface::create(IntSize size, ColorSpace colorSpace)
 {
-    // YUV422 IOSurfaces do not go in the pool.
-    if (pixelFormat == Format::RGBA) {
-        if (auto cachedSurface = surfaceFromPool(size, size, colorSpace))
-            return cachedSurface;
-    }
-
-    return std::unique_ptr<IOSurface>(new IOSurface(size, colorSpace, pixelFormat));
+    if (auto cachedSurface = surfaceFromPool(size, size, colorSpace))
+        return cachedSurface;
+    return std::unique_ptr<IOSurface>(new IOSurface(size, colorSpace));
 }
 
 std::unique_ptr<IOSurface> IOSurface::create(IntSize size, IntSize contextSize, ColorSpace colorSpace)
@@ -96,30 +92,17 @@
     return surface;
 }
 
-IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
+IOSurface::IOSurface(IntSize size, ColorSpace colorSpace)
     : m_colorSpace(colorSpace)
-    , m_format(format)
     , m_size(size)
     , m_contextSize(size)
 {
     unsigned pixelFormat = 'BGRA';
-    unsigned bytesPerPixel = 4;
     unsigned bytesPerElement = 4;
-    unsigned elementWidth = 1;
-
-#if PLATFORM(IOS)
-    if (format == Format::YUV422) {
-        pixelFormat = 'yuvf';
-        bytesPerPixel = 2;
-        elementWidth = 2;
-        bytesPerElement = 4;
-    }
-#endif
-
     int width = size.width();
     int height = size.height();
 
-    size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerPixel);
+    size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement);
     ASSERT(bytesPerRow);
 
     m_totalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow);
@@ -133,17 +116,15 @@
         (id)kIOSurfaceBytesPerRow: @(bytesPerRow),
         (id)kIOSurfaceAllocSize: @(m_totalBytes),
 #if PLATFORM(IOS)
-        (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache),
+        (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache)
 #endif
-        (id)kIOSurfaceElementWidth: @(elementWidth),
-        (id)kIOSurfaceElementHeight: @(1)
     };
 
     m_surface = adoptCF(IOSurfaceCreate((CFDictionaryRef)options));
 }
 
 IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace)
-    : IOSurface(size, colorSpace, Format::RGBA)
+    : IOSurface(size, colorSpace)
 {
     ASSERT(contextSize.width() <= size.width());
     ASSERT(contextSize.height() <= size.height());
@@ -152,7 +133,6 @@
 
 IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
     : m_colorSpace(colorSpace)
-    , m_format(Format::RGBA)
     , m_surface(surface)
 {
     m_size = IntSize(IOSurfaceGetWidth(surface), IOSurfaceGetHeight(surface));
@@ -248,39 +228,4 @@
     m_cgContext = nullptr;
 }
 
-#if PLATFORM(IOS)
- void IOSurface::convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format format, std::function<void(std::unique_ptr<WebCore::IOSurface>)> callback)
-{
-    static IOSurfaceAcceleratorRef accelerator;
-    if (!accelerator) {
-        IOSurfaceAcceleratorCreate(nullptr, nullptr, &accelerator);
-
-        auto runLoopSource = IOSurfaceAcceleratorGetRunLoopSource(accelerator);
-        CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, kCFRunLoopDefaultMode);
-    }
-
-    if (inSurface->format() == format) {
-        callback(WTF::move(inSurface));
-        return;
-    }
-
-    auto destinationSurface = IOSurface::create(inSurface->size(), inSurface->colorSpace(), format);
-    IOSurfaceRef destinationIOSurfaceRef = destinationSurface->surface();
-
-    IOSurfaceAcceleratorCompletion completion;
-    completion.completionRefCon = new std::function<void(std::unique_ptr<IOSurface>)> (WTF::move(callback));
-    completion.completionRefCon2 = destinationSurface.release();
-    completion.completionCallback = [](void *completionRefCon, IOReturn, void * completionRefCon2) {
-        auto* callback = static_cast<std::function<void(std::unique_ptr<WebCore::IOSurface>)>*>(completionRefCon);
-        auto destinationSurface = std::unique_ptr<IOSurface>(static_cast<IOSurface*>(completionRefCon2));
-        
-        (*callback)(WTF::move(destinationSurface));
-        delete callback;
-    };
-
-    IOReturn ret = IOSurfaceAcceleratorTransformSurface(accelerator, inSurface->surface(), destinationIOSurfaceRef, nullptr, nullptr, &completion, nullptr, nullptr);
-    ASSERT_UNUSED(ret, ret == kIOReturnSuccess);
-}
-#endif // PLATFORM(IOS)
-
 #endif // USE(IOSURFACE)

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h (192554 => 192555)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h	2015-11-18 00:27:05 UTC (rev 192554)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h	2015-11-18 00:27:09 UTC (rev 192555)
@@ -94,35 +94,6 @@
 
 WTF_EXTERN_C_END
 
-#if PLATFORM(IOS)
-#if USE(APPLE_INTERNAL_SDK)
+#endif
 
-#import <IOSurfaceAccelerator/IOSurfaceAccelerator.h>
-
-#else
-
-typedef struct __IOSurfaceAccelerator *IOSurfaceAcceleratorRef;
-
-WTF_EXTERN_C_BEGIN
-
-IOReturn IOSurfaceAcceleratorCreate(CFAllocatorRef allocator, CFDictionaryRef properties, IOSurfaceAcceleratorRef* acceleratorOut);
-CFRunLoopSourceRef IOSurfaceAcceleratorGetRunLoopSource(IOSurfaceAcceleratorRef accelerator);
-
-typedef void (*IOSurfaceAcceleratorCompletionCallback)(void* completionRefCon, IOReturn status, void* completionRefCon2);
-
-typedef struct IOSurfaceAcceleratorCompletion {
-    IOSurfaceAcceleratorCompletionCallback completionCallback;
-    void* completionRefCon;
-    void* completionRefCon2;
-} IOSurfaceAcceleratorCompletion;
-
-IOReturn IOSurfaceAcceleratorTransformSurface(IOSurfaceAcceleratorRef accelerator, IOSurfaceRef sourceBuffer, IOSurfaceRef destinationBuffer, CFDictionaryRef options, void* pCropRectangles, IOSurfaceAcceleratorCompletion* pCompletion, void* pSwap, uint32_t* pCommandID);
-
-WTF_EXTERN_C_END
-
-#endif // USE(APPLE_INTERNAL_SDK)
-#endif // PLATFORM(IOS)
-
-#endif // !PLATFORM(IOS_SIMULATOR)
-
 #endif // IOSurfaceSPI_h

Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (192554 => 192555)


--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-11-18 00:27:05 UTC (rev 192554)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-11-18 00:27:09 UTC (rev 192555)
@@ -1,5 +1,9 @@
 2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
 
+        Rollout r192419. rdar://problem/22846841
+
+2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
+
         Rollout r192475. rdar://problem/22846841
 
 2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
@@ -78,29 +82,6 @@
 
 2015-11-12  Matthew Hanson  <matthew_han...@apple.com>
 
-        Merge r190574. rdar://problem/22846841
-
-    2015-10-05  Beth Dakin  <bda...@apple.com>
-
-            Compress snapshots on iOS
-            https://bugs.webkit.org/show_bug.cgi?id=149814
-            -and corresponding-
-            rdar://problem/22976230
-
-            Reviewed by Simon Fraser.
-
-            Compress the snapshot.
-            * UIProcess/API/Cocoa/WKWebView.mm:
-            (-[WKWebView _takeViewSnapshot]):
-
-            Since the snapshots are converted to YUV asynchronously, it is possible to
-            get here and have a snapshot that does not yet have an image, so we have to
-            relax this constraint.
-            * UIProcess/mac/ViewSnapshotStore.mm:
-            (WebKit::ViewSnapshotStore::recordSnapshot):
-
-2015-11-12  Matthew Hanson  <matthew_han...@apple.com>
-
         Merge r189635. rdar://problem/22846841
 
     2015-09-11  Beth Dakin  <bda...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (192554 => 192555)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-11-18 00:27:05 UTC (rev 192554)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-11-18 00:27:09 UTC (rev 192555)
@@ -1114,12 +1114,7 @@
     auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceDeviceRGB);
     CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform);
 
-    RefPtr<WebKit::ViewSnapshot> viewSnapshot = WebKit::ViewSnapshot::create(nullptr);
-    WebCore::IOSurface::convertToFormat(WTF::move(surface), WebCore::IOSurface::Format::YUV422, [viewSnapshot](std::unique_ptr<WebCore::IOSurface> convertedSurface) {
-        viewSnapshot->setSurface(WTF::move(convertedSurface));
-    });
-
-    return viewSnapshot;
+    return WebKit::ViewSnapshot::create(nullptr);
 #else
     uint32_t slotID = [WebKit::ViewSnapshotStore::snapshottingContext() createImageSlot:snapshotSize hasAlpha:YES];
 

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm (192554 => 192555)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm	2015-11-18 00:27:05 UTC (rev 192554)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm	2015-11-18 00:27:09 UTC (rev 192555)
@@ -115,7 +115,7 @@
     webPageProxy.willRecordNavigationSnapshot(item);
 
     RefPtr<ViewSnapshot> snapshot = webPageProxy.takeViewSnapshot();
-    if (!snapshot)
+    if (!snapshot || !snapshot->hasImage())
         return;
 
     snapshot->setRenderTreeSize(webPageProxy.renderTreeSize());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to