| Summary: | Leverage the new Vector(const T*, size_t) constructor | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||||||
| Component: | Web Template Framework | Assignee: | Chris Dumez <cdumez> | ||||||||||||
| Status: | RESOLVED FIXED | ||||||||||||||
| Severity: | Normal | CC: | achristensen, alecflett, beidson, benjamin, berto, calvaris, cgarcia, cmarcelo, darin, eric.carlson, ews-watchlist, galpeter, ggaren, glenn, gustavo, hi, jer.noble, jiewen_tan, joepeck, jsbell, keith_miller, mark.lam, menard, msaboff, philipj, pnormand, saam, sam, sergio, toyoshim, tzagallo, vjaquez, webkit-bug-importer, yutak | ||||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||||
| Version: | WebKit Nightly Build | ||||||||||||||
| Hardware: | Unspecified | ||||||||||||||
| OS: | Unspecified | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Chris Dumez
2021-05-26 16:08:38 PDT
Created attachment 429809 [details]
Patch
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 Created attachment 429812 [details]
Patch
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. Created attachment 429823 [details]
Patch
Created attachment 429825 [details]
Patch
Created attachment 429827 [details]
Patch
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]. |