Title: [285471] branches/safari-612-branch/Source/WebCore
Revision
285471
Author
[email protected]
Date
2021-11-08 17:09:32 -0800 (Mon, 08 Nov 2021)

Log Message

Cherry-pick r285333. rdar://problem/83576009

    Avoid sending video data to Web process for canvas.drawImage(video)
    https://bugs.webkit.org/show_bug.cgi?id=230766
    <rdar://problem/83576009>

    Reviewed by Simon Fraser.

    Using nativeImageForCurrentTime() to get the image to paint on to the
    canvas results in a ShareableBitmap being created to send to the
    Web process, the identifier for which we then send back to the GPU
    process for the drawImage() call. But if we use
    paintCurrentFrameInContext(), this uses the PaintFrameForMedia
    message, which just sends the MediaPlayer ID and avoids the bitmap
    creation.

    * html/canvas/CanvasRenderingContext2DBase.cpp:
    (WebCore::CanvasRenderingContext2DBase::drawImage):
    * platform/graphics/ImageBuffer.h:
    (WebCore::ImageBuffer::isRemote const):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285333 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285470 => 285471)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-11-09 01:09:29 UTC (rev 285470)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-11-09 01:09:32 UTC (rev 285471)
@@ -1,5 +1,52 @@
 2021-11-08  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r285333. rdar://problem/83576009
+
+    Avoid sending video data to Web process for canvas.drawImage(video)
+    https://bugs.webkit.org/show_bug.cgi?id=230766
+    <rdar://problem/83576009>
+    
+    Reviewed by Simon Fraser.
+    
+    Using nativeImageForCurrentTime() to get the image to paint on to the
+    canvas results in a ShareableBitmap being created to send to the
+    Web process, the identifier for which we then send back to the GPU
+    process for the drawImage() call. But if we use
+    paintCurrentFrameInContext(), this uses the PaintFrameForMedia
+    message, which just sends the MediaPlayer ID and avoids the bitmap
+    creation.
+    
+    * html/canvas/CanvasRenderingContext2DBase.cpp:
+    (WebCore::CanvasRenderingContext2DBase::drawImage):
+    * platform/graphics/ImageBuffer.h:
+    (WebCore::ImageBuffer::isRemote const):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-04  Cameron McCormack  <[email protected]>
+
+            Avoid sending video data to Web process for canvas.drawImage(video)
+            https://bugs.webkit.org/show_bug.cgi?id=230766
+            <rdar://problem/83576009>
+
+            Reviewed by Simon Fraser.
+
+            Using nativeImageForCurrentTime() to get the image to paint on to the
+            canvas results in a ShareableBitmap being created to send to the
+            Web process, the identifier for which we then send back to the GPU
+            process for the drawImage() call. But if we use
+            paintCurrentFrameInContext(), this uses the PaintFrameForMedia
+            message, which just sends the MediaPlayer ID and avoids the bitmap
+            creation.
+
+            * html/canvas/CanvasRenderingContext2DBase.cpp:
+            (WebCore::CanvasRenderingContext2DBase::drawImage):
+            * platform/graphics/ImageBuffer.h:
+            (WebCore::ImageBuffer::isRemote const):
+
+2021-11-08  Kocsen Chung  <[email protected]>
+
         Cherry-pick r285236. rdar://problem/83950623
 
     AX: WKAccessibilityWebPageObjectMac.mm should expose accessibilityChildrenInNavigationOrder and NSAccessibilityChildrenInNavigationOrderAttribute

Modified: branches/safari-612-branch/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (285470 => 285471)


--- branches/safari-612-branch/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2021-11-09 01:09:29 UTC (rev 285470)
+++ branches/safari-612-branch/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2021-11-09 01:09:32 UTC (rev 285471)
@@ -1677,17 +1677,19 @@
     checkOrigin(&video);
 
 #if USE(CG)
-    if (auto image = video.nativeImageForCurrentTime()) {
-        c->drawNativeImage(*image, FloatSize(video.videoWidth(), video.videoHeight()), dstRect, srcRect);
+    if (c->hasPlatformContext()) {
+        if (auto image = video.nativeImageForCurrentTime()) {
+            c->drawNativeImage(*image, FloatSize(video.videoWidth(), video.videoHeight()), dstRect, srcRect);
 
-        if (isEntireBackingStoreDirty())
-            didDraw(std::nullopt);
-        else if (rectContainsCanvas(dstRect))
-            didDrawEntireCanvas();
-        else
-            didDraw(dstRect);
+            if (isEntireBackingStoreDirty())
+                didDraw(std::nullopt);
+            else if (rectContainsCanvas(dstRect))
+                didDrawEntireCanvas();
+            else
+                didDraw(dstRect);
 
-        return { };
+            return { };
+        }
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to