Title: [118896] trunk/Source/WebKit2
Revision
118896
Author
[email protected]
Date
2012-05-29 23:33:40 -0700 (Tue, 29 May 2012)

Log Message

Noticeable delay taking an HTML5 trailer fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=87794

Reviewed by Darin Adler.

Work around a not-entirely understood delay when using the results of a CGWindowListCreateImage()
call as the contents of a placeholder view.  The backing of the resulting CGImageRef resides on
the WindowServer, and drawing that image requires synchronous calls to the WindowServer process.
By copying the image data, up front, into our own process, we can avoid those synchronous calls
later and avoid the delay-causing drawing behavior.

* UIProcess/mac/WKFullScreenWindowController.mm:
(CGImageDeepCopy): Added a helper function which copies the image data into a new CGImage.
(-[WKFullScreenWindowController enterFullScreen:]): Use the above.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (118895 => 118896)


--- trunk/Source/WebKit2/ChangeLog	2012-05-30 06:17:46 UTC (rev 118895)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-30 06:33:40 UTC (rev 118896)
@@ -1,3 +1,20 @@
+2012-05-29  Jer Noble  <[email protected]>
+
+        Noticeable delay taking an HTML5 trailer fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=87794
+
+        Reviewed by Darin Adler.
+
+        Work around a not-entirely understood delay when using the results of a CGWindowListCreateImage()
+        call as the contents of a placeholder view.  The backing of the resulting CGImageRef resides on
+        the WindowServer, and drawing that image requires synchronous calls to the WindowServer process.
+        By copying the image data, up front, into our own process, we can avoid those synchronous calls
+        later and avoid the delay-causing drawing behavior.
+
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (CGImageDeepCopy): Added a helper function which copies the image data into a new CGImage.
+        (-[WKFullScreenWindowController enterFullScreen:]): Use the above.
+
 2012-05-29  Sudarsana Nagineni  <[email protected]>
 
         [GTK] [WK2] Reproducible crash in performDragControllerAction

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (118895 => 118896)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-05-30 06:17:46 UTC (rev 118895)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-05-30 06:33:40 UTC (rev 118896)
@@ -183,6 +183,28 @@
 #pragma mark -
 #pragma mark Exposed Interface
 
+static RetainPtr<CGDataProviderRef> createImageProviderWithCopiedData(CGDataProviderRef sourceProvider)
+{
+    RetainPtr<CFDataRef> data = ""
+    return adoptCF(CGDataProviderCreateWithCFData(data.get()));
+}
+
+static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
+{
+    size_t width = CGImageGetWidth(sourceImage);
+    size_t height = CGImageGetHeight(sourceImage);
+    size_t bitsPerComponent = CGImageGetBitsPerComponent(sourceImage);
+    size_t bitsPerPixel = CGImageGetBitsPerPixel(sourceImage);
+    size_t bytesPerRow = CGImageGetBytesPerRow(sourceImage);
+    CGColorSpaceRef colorSpace = CGImageGetColorSpace(sourceImage);
+    CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(sourceImage);
+    RetainPtr<CGDataProviderRef> provider = createImageProviderWithCopiedData(CGImageGetDataProvider(sourceImage));
+    bool shouldInterpolate = CGImageGetShouldInterpolate(sourceImage);
+    CGColorRenderingIntent intent = CGImageGetRenderingIntent(sourceImage);
+
+    return adoptCF(CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, bitmapInfo, provider.get(), 0, shouldInterpolate, intent));
+}
+
 - (void)enterFullScreen:(NSScreen *)screen
 {
     if (_isFullScreen)
@@ -204,6 +226,11 @@
     CGWindowID windowID = [[_webView window] windowNumber];
     RetainPtr<CGImageRef> webViewContents(AdoptCF, CGWindowListCreateImage(NSRectToCGRect(webViewFrame), kCGWindowListOptionIncludingWindow, windowID, kCGWindowImageShouldBeOpaque));
 
+    // Using the returned CGImage directly would result in calls to the WindowServer every time
+    // the image was painted. Instead, copy the image data into our own process to eliminate that
+    // future overhead.
+    webViewContents = createImageWithCopiedData(webViewContents.get());
+
     // Screen updates to be re-enabled in beganEnterFullScreenWithInitialFrame:finalFrame:
     NSDisableScreenUpdates();
     [[self window] setAutodisplay:NO];
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to