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:
authorAnna Henningsen <anna@addaleax.net>2019-03-05 03:28:45 +0300
committerAnna Henningsen <anna@addaleax.net>2020-04-06 03:06:35 +0300
commit6576b9b9d0f3de931e5e867a7b4b43319b187955 (patch)
tree11b377c01fb4c2910f66efd41847f3dfbc773eb2 /src/base_object.h
parentc2aedd0310f2efdeb2ae69e14ae9950880bde24a (diff)
src: make creating per-binding data structures easier
Enable the state associated with the individual bindings, e.g. fs or http2, to be moved out of the Environment class, in order for these to be more modular and for Environment to be come less of a collection of random data fields. Do this by using a BaseObject as the data for callbacks, which can hold the per-binding state. By default, no per-binding state is available, although that can be configured when setting up the binding. PR-URL: https://github.com/nodejs/node/pull/32538 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/base_object.h')
-rw-r--r--src/base_object.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/base_object.h b/src/base_object.h
index 2c67445c31f..03c69976ee4 100644
--- a/src/base_object.h
+++ b/src/base_object.h
@@ -61,9 +61,9 @@ class BaseObject : public MemoryRetainer {
// was also passed to the `BaseObject()` constructor initially.
// This may return `nullptr` if the C++ object has not been constructed yet,
// e.g. when the JS object used `MakeLazilyInitializedJSTemplate`.
- static inline BaseObject* FromJSObject(v8::Local<v8::Object> object);
+ static inline BaseObject* FromJSObject(v8::Local<v8::Value> object);
template <typename T>
- static inline T* FromJSObject(v8::Local<v8::Object> object);
+ static inline T* FromJSObject(v8::Local<v8::Value> object);
// Make the `v8::Global` a weak reference and, `delete` this object once
// the JS object has been garbage collected and there are no (strong)
@@ -152,7 +152,7 @@ class BaseObject : public MemoryRetainer {
// Global alias for FromJSObject() to avoid churn.
template <typename T>
-inline T* Unwrap(v8::Local<v8::Object> obj) {
+inline T* Unwrap(v8::Local<v8::Value> obj) {
return BaseObject::FromJSObject<T>(obj);
}