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
diff options
context:
space:
mode:
-rw-r--r--src/node_buffer.cc14
-rw-r--r--src/node_internals.h14
2 files changed, 14 insertions, 14 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index 39727fcdd14..9fed15622e0 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -234,6 +234,20 @@ size_t Length(Local<Object> obj) {
}
+inline MaybeLocal<Uint8Array> New(Environment* env,
+ Local<ArrayBuffer> ab,
+ size_t byte_offset,
+ size_t length) {
+ CHECK(!env->buffer_prototype_object().IsEmpty());
+ Local<Uint8Array> ui = Uint8Array::New(ab, byte_offset, length);
+ Maybe<bool> mb =
+ ui->SetPrototype(env->context(), env->buffer_prototype_object());
+ if (mb.IsNothing())
+ return MaybeLocal<Uint8Array>();
+ return ui;
+}
+
+
MaybeLocal<Object> New(Isolate* isolate,
Local<String> string,
enum encoding enc) {
diff --git a/src/node_internals.h b/src/node_internals.h
index 367df26c0e7..6f09708371b 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -128,20 +128,6 @@ v8::MaybeLocal<v8::Object> New(Environment* env,
// Mixing operator new and free() is undefined behavior so don't do that.
v8::MaybeLocal<v8::Object> New(Environment* env, char* data, size_t length);
-inline
-v8::MaybeLocal<v8::Uint8Array> New(Environment* env,
- v8::Local<v8::ArrayBuffer> ab,
- size_t byte_offset,
- size_t length) {
- v8::Local<v8::Uint8Array> ui = v8::Uint8Array::New(ab, byte_offset, length);
- CHECK(!env->buffer_prototype_object().IsEmpty());
- v8::Maybe<bool> mb =
- ui->SetPrototype(env->context(), env->buffer_prototype_object());
- if (mb.IsNothing())
- return v8::MaybeLocal<v8::Uint8Array>();
- return ui;
-}
-
// Construct a Buffer from a MaybeStackBuffer (and also its subclasses like
// Utf8Value and TwoByteValue).
// If |buf| is invalidated, an empty MaybeLocal is returned, and nothing is