Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2022-09-15 00:44:31 +0300
committerJuan José Arboleda <soyjuanarbol@gmail.com>2022-10-11 22:45:25 +0300
commit24172ca6fe3a79b07bb7e607e8dec21cd2b2068f (patch)
treee731babb1df17a9f670c2ffd30cd9590fe5b1e3e /src
parent9a469bef2cf748d8f2183df2a0a190b45769f390 (diff)
src: avoid copy when creating Blob
PR-URL: https://github.com/nodejs/node/pull/44616 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_blob.cc8
-rw-r--r--src/node_blob.h11
2 files changed, 7 insertions, 12 deletions
diff --git a/src/node_blob.cc b/src/node_blob.cc
index 142ba7465a4..c4af9de40cf 100644
--- a/src/node_blob.cc
+++ b/src/node_blob.cc
@@ -69,11 +69,9 @@ bool Blob::HasInstance(Environment* env, v8::Local<v8::Value> object) {
return GetConstructorTemplate(env)->HasInstance(object);
}
-BaseObjectPtr<Blob> Blob::Create(
- Environment* env,
- const std::vector<BlobEntry> store,
- size_t length) {
-
+BaseObjectPtr<Blob> Blob::Create(Environment* env,
+ const std::vector<BlobEntry>& store,
+ size_t length) {
HandleScope scope(env->isolate());
Local<Function> ctor;
diff --git a/src/node_blob.h b/src/node_blob.h
index 61f4da655c9..a1f7293bfff 100644
--- a/src/node_blob.h
+++ b/src/node_blob.h
@@ -45,16 +45,13 @@ class Blob : public BaseObject {
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
Environment* env);
- static BaseObjectPtr<Blob> Create(
- Environment* env,
- const std::vector<BlobEntry> store,
- size_t length);
+ static BaseObjectPtr<Blob> Create(Environment* env,
+ const std::vector<BlobEntry>& store,
+ size_t length);
static bool HasInstance(Environment* env, v8::Local<v8::Value> object);
- const std::vector<BlobEntry> entries() const {
- return store_;
- }
+ const std::vector<BlobEntry>& entries() const { return store_; }
void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(Blob)