Browse Source

node: remove domain nextTick

It's ridiculously cheap to check if process.domain is set. Don't bother
cluttering the code.
v0.11.6-release
Trevor Norris 12 years ago
parent
commit
2ef1782bbc
  1. 8
      src/node.cc
  2. 15
      src/node.js

8
src/node.cc

@ -910,20 +910,12 @@ void SetupDomainUse(const FunctionCallbackInfo<Value>& args) {
Local<Object> process = PersistentToLocal(node_isolate, process_p);
Local<Value> tdc_v =
process->Get(FIXED_ONE_BYTE_STRING(node_isolate, "_tickDomainCallback"));
Local<Value> ndt_v =
process->Get(FIXED_ONE_BYTE_STRING(node_isolate, "_nextDomainTick"));
if (!tdc_v->IsFunction()) {
fprintf(stderr, "process._tickDomainCallback assigned to non-function\n");
abort();
}
if (!ndt_v->IsFunction()) {
fprintf(stderr, "process._nextDomainTick assigned to non-function\n");
abort();
}
Local<Function> tdc = tdc_v.As<Function>();
Local<Function> ndt = ndt_v.As<Function>();
process->Set(FIXED_ONE_BYTE_STRING(node_isolate, "_tickCallback"), tdc);
process->Set(FIXED_ONE_BYTE_STRING(node_isolate, "nextTick"), ndt);
process_tickCallback.Reset(node_isolate, tdc);
}

15
src/node.js

@ -330,7 +330,6 @@
process.nextTick = nextTick;
// needs to be accessible from cc land
process._nextDomainTick = _nextDomainTick;
process._tickCallback = _tickCallback;
process._tickDomainCallback = _tickDomainCallback;
@ -415,16 +414,10 @@
if (process._exiting)
return;
nextTickQueue.push({ callback: callback, domain: null });
infoBox[length]++;
}
function _nextDomainTick(callback) {
// on the way out, don't bother. it won't get fired anyway.
if (process._exiting)
return;
nextTickQueue.push({ callback: callback, domain: process.domain });
nextTickQueue.push({
callback: callback,
domain: process.domain || null
});
infoBox[length]++;
}
};

Loading…
Cancel
Save