| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9cfb418 commit 6cb314b
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,6 +53,7 @@ Maybe<int> SpinEventLoop(Environment* env) { | |||
| 53 | 53 | if (env->is_stopping()) return Nothing<int>(); | |
| 54 | 54 | ||
| 55 | 55 | env->set_trace_sync_io(false); | |
| 56 | + env->PrintInfoForSnapshotIfDebug(); | ||
| 56 | 57 | env->VerifyNoStrongBaseObjects(); | |
| 57 | 58 | return EmitProcessExit(env); | |
| 58 | 59 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1232,6 +1232,25 @@ void Environment::RemoveUnmanagedFd(int fd) { | |||
| 1232 | 1232 | } | |
| 1233 | 1233 | } | |
| 1234 | 1234 | ||
| 1235 | + void Environment::PrintInfoForSnapshotIfDebug() { | ||
| 1236 | + if (enabled_debug_list()->enabled(DebugCategory::MKSNAPSHOT)) { | ||
| 1237 | + fprintf(stderr, "BaseObjects at the exit of the Environment:\n"); | ||
| 1238 | + PrintAllBaseObjects(); | ||
| 1239 | + fprintf(stderr, "\nNative modules without cache:\n"); | ||
| 1240 | + for (const auto& s : native_modules_without_cache) { | ||
| 1241 | + fprintf(stderr, "%s\n", s.c_str()); | ||
| 1242 | + } | ||
| 1243 | + fprintf(stderr, "\nNative modules with cache:\n"); | ||
| 1244 | + for (const auto& s : native_modules_with_cache) { | ||
| 1245 | + fprintf(stderr, "%s\n", s.c_str()); | ||
| 1246 | + } | ||
| 1247 | + fprintf(stderr, "\nStatic bindings (need to be registered):\n"); | ||
| 1248 | + for (const auto mod : internal_bindings) { | ||
| 1249 | + fprintf(stderr, "%s:%s\n", mod->nm_filename, mod->nm_modname); | ||
| 1250 | + } | ||
| 1251 | + } | ||
| 1252 | + } | ||
| 1253 | + | ||
| 1235 | 1254 | void Environment::PrintAllBaseObjects() { | |
| 1236 | 1255 | size_t i = 0; | |
| 1237 | 1256 | std::cout << "BaseObjects\n"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -960,6 +960,7 @@ class Environment : public MemoryRetainer { | |||
| 960 | 960 | void CreateProperties(); | |
| 961 | 961 | void DeserializeProperties(const EnvSerializeInfo* info); | |
| 962 | 962 | ||
| 963 | + void PrintInfoForSnapshotIfDebug(); | ||
| 963 | 964 | void PrintAllBaseObjects(); | |
| 964 | 965 | void VerifyNoStrongBaseObjects(); | |
| 965 | 966 | void EnqueueDeserializeRequest(DeserializeRequestCallback cb, | |
@@ -1123,6 +1124,7 @@ class Environment : public MemoryRetainer { | |||
| 1123 | 1124 | // List of id's that have been destroyed and need the destroy() cb called. | |
| 1124 | 1125 | inline std::vector<double>* destroy_async_id_list(); | |
| 1125 | 1126 | ||
| 1127 | + std::set<struct node_module*> internal_bindings; | ||
| 1126 | 1128 | std::set<std::string> native_modules_with_cache; | |
| 1127 | 1129 | std::set<std::string> native_modules_without_cache; | |
| 1128 | 1130 | // This is only filled during deserialization. We use a vector since | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -582,6 +582,7 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) { | |||
| 582 | 582 | node_module* mod = FindModule(modlist_internal, *module_v, NM_F_INTERNAL); | |
| 583 | 583 | if (mod != nullptr) { | |
| 584 | 584 | exports = InitModule(env, mod, module); | |
| 585 | + env->internal_bindings.insert(mod); | ||
| 585 | 586 | } else if (!strcmp(*module_v, "constants")) { | |
| 586 | 587 | exports = Object::New(env->isolate()); | |
| 587 | 588 | CHECK( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments