Skip to content
Permalink
Browse files
src: avoid copy when creating Blob
PR-URL: #44616
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
  • Loading branch information
tniessen authored and RafaelGSS committed Sep 26, 2022
1 parent 5ab3bc9 commit 29f57b7899dcb032624e1bec54e883723bb1851c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
@@ -71,11 +71,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;
@@ -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)

0 comments on commit 29f57b7

Please sign in to comment.