MCPcopy Index your code
hub / github.com/nodejs/node / setDeserializeMainFunction

Function setDeserializeMainFunction

lib/internal/v8/startup_snapshot.js:95–119  ·  view source on GitHub ↗
(callback, data)

Source from the content-addressed store, hash-verified

93
94let deserializeMainIsSet = false;
95function setDeserializeMainFunction(callback, data) {
96 throwIfNotBuildingSnapshot();
97 // TODO(joyeecheung): In lib/internal/bootstrap/node.js, create a default
98 // main function to run the lib/internal/main scripts and make sure that
99 // the main function set in the snapshot building process takes precedence.
100 validateFunction(callback, 'callback');
101 if (deserializeMainIsSet) {
102 throw new ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION();
103 }
104 deserializeMainIsSet = true;
105
106 _setDeserializeMainFunction(function deserializeMain() {
107 const {
108 prepareMainThreadExecution,
109 markBootstrapComplete,
110 } = require('internal/process/pre_execution');
111
112 // This should be in sync with run_main_module.js until we make that
113 // a built-in main function.
114 // TODO(joyeecheung): make a copy of argv[0] and insert it as argv[1].
115 prepareMainThreadExecution(false);
116 markBootstrapComplete();
117 callback(data);
118 });
119}
120
121initializeCallbacks();
122module.exports = {

Callers 15

snapshot.jsFile · 0.85
snapshot.jsFile · 0.85
snapshot.jsFile · 0.85
error-stack.jsFile · 0.85
dns-lookup.jsFile · 0.85
create-worker.jsFile · 0.85
dns-resolve.jsFile · 0.85
create-vm.jsFile · 0.85

Calls 5

markBootstrapCompleteFunction · 0.85
requireFunction · 0.50
callbackFunction · 0.50

Tested by

no test coverage detected