[webkit-reviews] review granted: [Bug 226304] Leverage the new Vector(const T*, size_t) constructor : [Attachment 429812] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed May 26 18:08:16 PDT 2021
Darin Adler <darin at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 226304: Leverage the new Vector(const T*, size_t) constructor
https://bugs.webkit.org/show_bug.cgi?id=226304
Attachment 429812: Patch
https://bugs.webkit.org/attachment.cgi?id=429812&action=review
--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 429812
--> https://bugs.webkit.org/attachment.cgi?id=429812
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.
More information about the webkit-reviews
mailing list