WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
236749
Unnecessary copy/memory allocation
https://bugs.webkit.org/show_bug.cgi?id=236749
Summary
Unnecessary copy/memory allocation
Jean-Yves Avenard [:jya]
Reported
2022-02-16 20:21:00 PST
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.
Attachments
Patch
(1.73 KB, patch)
2022-02-16 20:39 PST
,
Jean-Yves Avenard [:jya]
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2022-02-16 20:21:50 PST
<
rdar://problem/89064893
>
Jean-Yves Avenard [:jya]
Comment 2
2022-02-16 20:39:01 PST
Created
attachment 452300
[details]
Patch
EWS
Comment 3
2022-02-17 15:27:03 PST
Committed
r290082
(
247438@main
): <
https://commits.webkit.org/247438@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 452300
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug