WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
226304
Leverage the new Vector(const T*, size_t) constructor
https://bugs.webkit.org/show_bug.cgi?id=226304
Summary
Leverage the new Vector(const T*, size_t) constructor
Chris Dumez
Reported
2021-05-26 16:08:38 PDT
Leverage the new Vector(const T*, size_t) constructor in existing code.
Attachments
Patch
(39.84 KB, patch)
2021-05-26 16:10 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(39.87 KB, patch)
2021-05-26 16:31 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(45.06 KB, patch)
2021-05-26 18:47 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(44.91 KB, patch)
2021-05-26 18:56 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(45.01 KB, patch)
2021-05-26 19:16 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2021-05-26 16:10:58 PDT
Created
attachment 429809
[details]
Patch
EWS Watchlist
Comment 2
2021-05-26 16:11:38 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See
https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Chris Dumez
Comment 3
2021-05-26 16:31:39 PDT
Created
attachment 429812
[details]
Patch
Darin Adler
Comment 4
2021-05-26 18:08:16 PDT
Comment on
attachment 429812
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=429812&action=review
> Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp:47 > + Vector<uint8_t> value { data, length }; > return Blob::create(context, WTFMove(value), Blob::normalizedContentType(contentType));
Maybe merge this into a single line. We can omit the WTFMove so it won’t necessarily be a super-long line.
> Source/WebCore/Modules/indexeddb/IDBGetResult.cpp:38 > + Vector<uint8_t> data { reinterpret_cast<const uint8_t*>(buffer.data()), buffer.size() }; > m_value = ThreadSafeDataBuffer::create(WTFMove(data));
Ditto. Also use dataAsUInt8Ptr() to avoid the reinterpret_cast.
> Source/WebCore/Modules/webauthn/fido/FidoHidPacket.cpp:123 > + Vector<uint8_t> data = { serialized.begin() + index, dataSize };
No need for the "=" here.
> Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm:65 > inline Vector<uint8_t> vectorFromNSData(NSData* data)
Surprised that this is the only place this function is needed. Also, should be marked static since it’s intended to have internal linkage.
> Source/WebCore/fileapi/Blob.cpp:117 > + blobParts.append(BlobPart(Vector<uint8_t> { reinterpret_cast<const uint8_t*>(buffer.data()), buffer.size() }));
Use dataAsUInt8Ptr() to avoid the reinterpret_cast.
> Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:296 > static Vector<uint8_t> vectorFromNSData(NSData* data)
Here it is, another copy of the same function as in SerializedCryptoKeyWrapMac.mm. With the same name.
> Source/WebKit/UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:46 > static inline Vector<uint8_t> convertBytesToVector(const uint8_t byteArray[], const size_t length)
Don’t really need a function for this any more. Could just put the braces down below.
> Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:91 > static inline Vector<uint8_t> toVector(NSData *data)
A third copy of the same function as in SerializedCryptoKeyWrapMac.mm. This time with a different name.
> Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:95 > + return { reinterpret_cast<const uint8_t*>(responseData.bytes), responseData.length };
This could use one of those many "convert NSData to Vector" functions.
> Source/WebKit/UIProcess/WebURLSchemeTask.cpp:224 > + data = { reinterpret_cast<const uint8_t*>(m_syncData->data()), m_syncData->size() };
Use dataAsUInt8Ptr() to avoid the reinterpret_cast.
Chris Dumez
Comment 5
2021-05-26 18:47:19 PDT
Created
attachment 429823
[details]
Patch
Chris Dumez
Comment 6
2021-05-26 18:56:24 PDT
Created
attachment 429825
[details]
Patch
Chris Dumez
Comment 7
2021-05-26 19:16:19 PDT
Created
attachment 429827
[details]
Patch
EWS
Comment 8
2021-05-26 20:17:35 PDT
Committed
r278146
(
238190@main
): <
https://commits.webkit.org/238190@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 429827
[details]
.
Radar WebKit Bug Importer
Comment 9
2021-05-26 20:18:22 PDT
<
rdar://problem/78548298
>
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