Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Rename the domain module to 'domains'

  • Loading branch information...
ry committed Sep 18, 2011
1 parent a22cb64 commit 8d90ae25c0dee8530b44151db6cd12e9b1ec603e
Showing with 35 additions and 35 deletions.
  1. 0 lib/{domain.js → domains.js}
  2. +4 −4 lib/fs.js
  3. +5 −5 lib/net_uv.js
  4. +20 −20 lib/timers_uv.js
  5. +4 −4 src/node.js
  6. +2 −2 test/simple/test-domains.js
File renamed without changes.
@@ -40,25 +40,25 @@ function wrapReq(method /* , args */) {
args[i - 1] = arguments[i];
}

// If we're using domains, remove the req from the domain
// If we're using domains, remove the req from the domains
// before making the final callback.
if (process.features.domains) {
assert.ok(l > 0);
var callback = args[l - 1];
args[l - 1] = function() {
// closeReq
require('domain').remove(req);
require('domains').remove(req);
callback.call(this, arguments);
};
}

var req = binding[method].apply(binding, args);
if (process.features.domains) require('domain').add(req);
if (process.features.domains) require('domains').add(req);
return req;
}

function closeReq(req) {
if (process.features.domains) require('domain').remove(req);
if (process.features.domains) require('domains').remove(req);
}


@@ -3,21 +3,21 @@ var stream = require('stream');
var timers = require('timers');
var util = require('util');
var assert = require('assert');
var domain = require('domain');
var domains = require('domains');

// constructor for lazy loading
function createPipe() {
var Pipe = process.binding('pipe_wrap').Pipe;
var pipe = new Pipe();
domain.add(pipe);
domains.add(pipe);
return pipe;
}

// constructor for lazy loading
function createTCP() {
var TCP = process.binding('tcp_wrap').TCP;
var tcp = new TCP();
domain.add(tcp);
domains.add(tcp);
return tcp;
}

@@ -44,12 +44,12 @@ function isPipeName(s) {

function close(handle) {
handle.close();
domain.remove(handle);
domains.remove(handle);
}


function closeReq(req) {
domain.remove(req);
domains.remove(req);
}


@@ -33,7 +33,7 @@ if (process.env.NODE_DEBUG && /timer/.test(process.env.NODE_DEBUG)) {

function closeTimer(t) {
t.close();
require('domain').remove(t);
require('domains').remove(t);
}


@@ -68,8 +68,8 @@ function insert(item, msecs) {
// This is a special timer which is owned by Node. It must only be in
// the defaultDomain. When it makes callbacks it iterates through a link list
// of pseudo handles and invokes a callback on each. Each item in that
// list can be associated with a domain.
require('domain').addDefaultDomain(list);
// list can be associated with a domains.
require('domains').addDefaultDomain(list);

list.start(msecs, 0);

@@ -80,10 +80,10 @@ function insert(item, msecs) {
list.ontimeout = function() {
if (process.features.domains) {
assert(this == list);
assert(list.domain);
assert(list.domain == require('domain').defaultDomain);
assert(require('domain').getCurrent() ==
require('domain').defaultDomain);
assert(list.domains);
assert(list.domains == require('domains').defaultDomain);
assert(require('domains').getCurrent() ==
require('domains').defaultDomain);
}

debug('timeout callback ' + msecs);
@@ -104,15 +104,15 @@ function insert(item, msecs) {

if (first._onTimeout) {
if (process.features.domains) {
// Enter the domain during the callback. 'first' is a pseudo
// Enter the domains during the callback. 'first' is a pseudo
// handle here - actually a pure javascript object but we treat
// it as its own handle.
process.dispatch(first, "_onTimeout");
assert(this == list);
assert(list.domain);
assert(list.domain == require('domain').defaultDomain);
assert(require('domain').getCurrent() ==
require('domain').defaultDomain);
assert(list.domains);
assert(list.domains == require('domains').defaultDomain);
assert(require('domains').getCurrent() ==
require('domains').defaultDomain);
} else {
first._onTimeout();
}
@@ -124,10 +124,10 @@ function insert(item, msecs) {
assert(L.isEmpty(list));

if (process.features.domains) {
assert(list.domain);
assert(list.domain == require('domain').defaultDomain);
assert(require('domain').getCurrent() ==
require('domain').defaultDomain,
assert(list.domains);
assert(list.domains == require('domains').defaultDomain);
assert(require('domains').getCurrent() ==
require('domains').defaultDomain,
"not in defaultDomain when we expected to be");
}

@@ -143,7 +143,7 @@ function insert(item, msecs) {

var unenroll = exports.unenroll = function(item) {
L.remove(item);
require('domain').remove(item);
require('domains').remove(item);

var list = lists[item._idleTimeout];
// if empty then stop the watcher
@@ -192,7 +192,7 @@ function TimerElement(after) {
this._idleTimeout = after;
this._idlePrev = this;
this._idleNext = this;
require('domain').add(this);
require('domains').add(this);
}


@@ -202,7 +202,7 @@ exports.setTimeout = function(callback, after) {
if (after <= 0) {
// Use the slow case for after == 0
timer = new Timer();
require('domain').add(timer);
require('domains').add(timer);

timer.ontimeout = callback;

@@ -256,7 +256,7 @@ exports.clearTimeout = function(timer) {

exports.setInterval = function(callback, repeat) {
var timer = new Timer();
require('domain').add(timer);
require('domains').add(timer);

var args = Array.prototype.slice.call(arguments, 2);
timer.ontimeout = function() {
@@ -198,8 +198,8 @@
if (l === 0) return;

if (process.features.domains) {
var domain = NativeModule.require('domain');
assert(domain.getCurrent() == domain.defaultDomain);
var domains = NativeModule.require('domains');
assert(domains.getCurrent() == domains.defaultDomain);
}

try {
@@ -545,7 +545,7 @@
if (obj.domain) {
domain = obj.domain
} else {
domain = NativeModule.require('domain').defaultDomain;
domain = NativeModule.require('domains').defaultDomain;
}

domain.enter();
@@ -560,7 +560,7 @@

domain.exit();

NativeModule.require('domain').pollNewDomains();
NativeModule.require('domains').pollNewDomains();
}

startup();
@@ -21,14 +21,14 @@

var common = require('../common');
var assert = require('assert');
var domain = require('domain');
var domains = require('domains');

var timerCalled = false;
var connectCallbackCalled = false;

console.log("default domain");

var d = domain.create({ hello: "world" }, function(a) {
var d = domains.create({ hello: "world" }, function(a) {
console.log("inside the domain");
assert.deepEqual(a, { hello: "world" });

0 comments on commit 8d90ae2

Please sign in to comment.
You can’t perform that action at this time.