summaryrefslogtreecommitdiff
path: root/src/module_wrap.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-09-21 01:50:07 +0200
committerAnna Henningsen <anna@addaleax.net>2017-09-23 16:57:35 +0200
commit150b8f7fda526b52f07070b25f404f0b417d6d27 (patch)
treee8c33c409d7d89a14fb1d0a0b382fc7cb6afbea3 /src/module_wrap.h
parentb605b15346f2a594d6b9031934eadc5625f871f9 (diff)
downloadnode-new-150b8f7fda526b52f07070b25f404f0b417d6d27.tar.gz
src: minor c++ refactors to module_wrap
- Move `module_map` to `Environment` instead of having it be global state - `std::map` → `std::unordered_map` - Remove one level of indirection for the map values - Clean up empty vectors in `module_map` - Call `Reset()` on all persistent handles in `resolve_cache_` - Add a missing `HandleScope` to `ModuleWrap::~ModuleWrap()` PR-URL: https://github.com/nodejs/node/pull/15515 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'src/module_wrap.h')
-rw-r--r--src/module_wrap.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/module_wrap.h b/src/module_wrap.h
index c669834c6f..0d8b41552b 100644
--- a/src/module_wrap.h
+++ b/src/module_wrap.h
@@ -3,7 +3,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
-#include <map>
+#include <unordered_map>
#include <string>
#include <vector>
#include "node_url.h"
@@ -45,9 +45,7 @@ class ModuleWrap : public BaseObject {
v8::Persistent<v8::Module> module_;
v8::Persistent<v8::String> url_;
bool linked_ = false;
- std::map<std::string, v8::Persistent<v8::Promise>*> resolve_cache_;
-
- static std::map<int, std::vector<ModuleWrap*>*> module_map_;
+ std::unordered_map<std::string, v8::Persistent<v8::Promise>> resolve_cache_;
};
} // namespace loader