[GCrypt] Use utility functions in CryptoKeyEC, CryptoKeyRSA
Created attachment 312647 [details] Patch
Comment on attachment 312647 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312647&action=review Nice! > Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp:227 > + return WTFMove(q.value()); Why do you use WTFMove() here? Doesn't this prevent return value optimization? > Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:70 > + return WTFMove(data.value()); Ditto.
Comment on attachment 312647 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312647&action=review >> Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp:227 >> + return WTFMove(q.value()); > > Why do you use WTFMove() here? Doesn't this prevent return value optimization? RVO doesn't help here because q is a std::optional<> object. `q.value()` exposes the embedded Vector<> object, but returning just that would result in copying the object. So the embedded value has to be casted to an rvalue reference via WTFMove() to enforce the move constructor to be generated. So the Vector<> object inside std::optional<> is moved into the return value, and after that std::optional<> deletes the emptied-out Vector<> it still holds.
Comment on attachment 312647 [details] Patch Clearing flags on attachment: 312647 Committed r218100: <http://trac.webkit.org/changeset/218100>
All reviewed patches have been landed. Closing bug.