Bug 203884

Summary: [Cairo] Cairo graphics backend uses ImageBuffer::copyImage just to access native image buffer handles
Product: WebKit Reporter: Chris Lord <clord>
Component: Layout and RenderingAssignee: Chris Lord <clord>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, cgarcia, commit-queue, don.olmstead, Hironori.Fujii, sabouhallawa, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 182686    
Attachments:
Description Flags
Patch none

Description Chris Lord 2019-11-06 02:50:08 PST
This pattern occurs a lot in the Cairo graphics backend:

    RefPtr<Image> image = layerImage.copyImage(DontCopyBackingStore);
    if (!image)
        return;

    if (auto surface = image->nativeImageForCurrentFrame()) {
        ...
    }

Which is fine on a single thread, but ImageSource is not usable off-main-thread, so any drawing that calls functions that do this will cause an assert on a debug build. I think its use of ImageSource would be safe off-main-thread, but it's overkill just to get the native image handle. This is hampering OffscreenCanvas.
Comment 1 Chris Lord 2019-11-06 03:01:43 PST
Created attachment 382908 [details]
Patch
Comment 2 WebKit Commit Bot 2019-11-06 05:13:17 PST
Comment on attachment 382908 [details]
Patch

Clearing flags on attachment: 382908

Committed r252136: <https://trac.webkit.org/changeset/252136>
Comment 3 WebKit Commit Bot 2019-11-06 05:13:19 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2019-11-06 05:14:18 PST
<rdar://problem/56940631>