[Webkit-unassigned] [Bug 236749] New: Unnecessary copy/memory allocation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 16 20:21:00 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=236749

            Bug ID: 236749
           Summary: Unnecessary copy/memory allocation
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Page Loading
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jean-yves.avenard at apple.com
                CC: beidson at apple.com

We see:
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm

https://github.com/WebKit/WebKit/blob/f0427c65db487c75295c5bd757777cb5d9049030/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm#L3544-L3547

```
    if (auto* image = hitTestResult.image()) {
        if (RefPtr<WebCore::FragmentedSharedBuffer> buffer = image->data())
            [items addObject:adoptNS([[NSImage alloc] initWithData:[NSData dataWithBytes:buffer->makeContiguous()->data() length:buffer->size()]]).get()];
    }
```

we can create a NSData from the SharedBuffer directly, removing the need for the memory allocation and copy.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220217/6837cd55/attachment.htm>


More information about the webkit-unassigned mailing list