File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,20 @@ size_t Length(Local<Object> obj) {
234234}
235235
236236
237+ inline MaybeLocal<Uint8Array> New (Environment* env,
238+ Local<ArrayBuffer> ab,
239+ size_t byte_offset,
240+ size_t length) {
241+ CHECK (!env->buffer_prototype_object ().IsEmpty ());
242+ Local<Uint8Array> ui = Uint8Array::New (ab, byte_offset, length);
243+ Maybe<bool > mb =
244+ ui->SetPrototype (env->context (), env->buffer_prototype_object ());
245+ if (mb.IsNothing ())
246+ return MaybeLocal<Uint8Array>();
247+ return ui;
248+ }
249+
250+
237251MaybeLocal<Object> New (Isolate* isolate,
238252 Local<String> string,
239253 enum encoding enc) {
Original file line number Diff line number Diff line change @@ -128,20 +128,6 @@ v8::MaybeLocal<v8::Object> New(Environment* env,
128128// Mixing operator new and free() is undefined behavior so don't do that.
129129v8::MaybeLocal<v8::Object> New (Environment* env, char * data, size_t length);
130130
131- inline
132- v8::MaybeLocal<v8::Uint8Array> New (Environment* env,
133- v8::Local<v8::ArrayBuffer> ab,
134- size_t byte_offset,
135- size_t length) {
136- v8::Local<v8::Uint8Array> ui = v8::Uint8Array::New (ab, byte_offset, length);
137- CHECK (!env->buffer_prototype_object ().IsEmpty ());
138- v8::Maybe<bool > mb =
139- ui->SetPrototype (env->context (), env->buffer_prototype_object ());
140- if (mb.IsNothing ())
141- return v8::MaybeLocal<v8::Uint8Array>();
142- return ui;
143- }
144-
145131// Construct a Buffer from a MaybeStackBuffer (and also its subclasses like
146132// Utf8Value and TwoByteValue).
147133// If |buf| is invalidated, an empty MaybeLocal is returned, and nothing is
You can’t perform that action at this time.
0 commit comments