src: move shared_ptr objects in KeyObjectData

Since copying `shared_ptr` may involve costly atomic operations,
explicitly move both `shared_ptr` objects that are passed to the
private KeyObjectData constructor.

PR-URL: https://github.com/nodejs/node/pull/59472
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Tobias Nießen 2025-08-16 18:06:22 +02:00 committed by GitHub
parent ceaead7c59
commit 80fb4fe2a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -127,7 +127,7 @@ class KeyObjectData final : public MemoryRetainer {
KeyObjectData(KeyType type,
std::shared_ptr<Mutex> mutex,
std::shared_ptr<Data> data)
: key_type_(type), mutex_(mutex), data_(data) {}
: key_type_(type), mutex_(std::move(mutex)), data_(std::move(data)) {}
};
class KeyObjectHandle : public BaseObject {