Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 24172ca

Browse filesBrowse files
tniessenjuanarbol
authored andcommitted
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>
1 parent 9a469be commit 24172ca
Copy full SHA for 24172ca

File tree

Expand file treeCollapse file tree

2 files changed

+7
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-12
lines changed
Open diff view settings
Collapse file

‎src/node_blob.cc‎

Copy file name to clipboardExpand all lines: src/node_blob.cc
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ bool Blob::HasInstance(Environment* env, v8::Local<v8::Value> object) {
6969
return GetConstructorTemplate(env)->HasInstance(object);
7070
}
7171

72-
BaseObjectPtr<Blob> Blob::Create(
73-
Environment* env,
74-
const std::vector<BlobEntry> store,
75-
size_t length) {
76-
72+
BaseObjectPtr<Blob> Blob::Create(Environment* env,
73+
const std::vector<BlobEntry>& store,
74+
size_t length) {
7775
HandleScope scope(env->isolate());
7876

7977
Local<Function> ctor;
Collapse file

‎src/node_blob.h‎

Copy file name to clipboardExpand all lines: src/node_blob.h
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,13 @@ class Blob : public BaseObject {
4545
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
4646
Environment* env);
4747

48-
static BaseObjectPtr<Blob> Create(
49-
Environment* env,
50-
const std::vector<BlobEntry> store,
51-
size_t length);
48+
static BaseObjectPtr<Blob> Create(Environment* env,
49+
const std::vector<BlobEntry>& store,
50+
size_t length);
5251

5352
static bool HasInstance(Environment* env, v8::Local<v8::Value> object);
5453

55-
const std::vector<BlobEntry> entries() const {
56-
return store_;
57-
}
54+
const std::vector<BlobEntry>& entries() const { return store_; }
5855

5956
void MemoryInfo(MemoryTracker* tracker) const override;
6057
SET_MEMORY_INFO_NAME(Blob)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.