summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2018-12-05 17:24:49 -0800
committerGabriel Schulhof <gabriel.schulhof@intel.com>2018-12-19 18:35:38 -0800
commit13abc6adfb9f6a53618ca7d533d31b6a5d26dcec (patch)
treec926fad94aa23bf3bec5af81b975efa0771338da /src/env.h
parent622e348d8f70a4ec006ee1ce9207a6a5bc3fc325 (diff)
downloadandroid-node-v8-13abc6adfb9f6a53618ca7d533d31b6a5d26dcec.tar.gz
android-node-v8-13abc6adfb9f6a53618ca7d533d31b6a5d26dcec.tar.bz2
android-node-v8-13abc6adfb9f6a53618ca7d533d31b6a5d26dcec.zip
src: unload addons when environment quits
This is an alternative to https://github.com/nodejs/node/pull/23319 which attaches the loaded addons to the environment and closes them when the environment is destroyed. PR-URL: https://github.com/nodejs/node/pull/24861 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/env.h b/src/env.h
index 7eb8a557e6..934c160197 100644
--- a/src/env.h
+++ b/src/env.h
@@ -30,6 +30,7 @@
#endif
#include "handle_wrap.h"
#include "node.h"
+#include "node_binding.h"
#include "node_http2_state.h"
#include "node_options.h"
#include "req_wrap.h"
@@ -37,11 +38,12 @@
#include "uv.h"
#include "v8.h"
-#include <list>
#include <stdint.h>
-#include <vector>
+#include <functional>
+#include <list>
#include <unordered_map>
#include <unordered_set>
+#include <vector>
struct nghttp2_rcbuf;
@@ -637,6 +639,9 @@ class Environment {
inline v8::Isolate* isolate() const;
inline uv_loop_t* event_loop() const;
inline uint32_t watched_providers() const;
+ inline void TryLoadAddon(const char* filename,
+ int flags,
+ std::function<bool(binding::DLib*)> was_loaded);
static inline Environment* from_timer_handle(uv_timer_t* handle);
inline uv_timer_t* timer_handle();
@@ -923,6 +928,7 @@ class Environment {
inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
const char* errmsg);
+ std::list<binding::DLib> loaded_addons_;
v8::Isolate* const isolate_;
IsolateData* const isolate_data_;
uv_timer_t timer_handle_;