Comparing changes
Open a pull request
base repository: nodejs/node-v0.x-archive
base: 48d05e9f1017^
head repository: nodejs/node-v0.x-archive
compare: 30902485c4c1
- 19 commits
- 57 files changed
- 3 contributors
Commits on Oct 17, 2013
-
node: don't share state with in_tick/last_threw
There was no need to share state between C++ and JS for these two values. So they have been moved to their respective locations. This will help performance only a tiny bit, but it does help code complexity much more.
-
node: add AsyncListener support
The AsyncWrap class has been added as a base class for everything that will be performing an asynchronous request. This is meant to be a simpler way to track when requests have gone out, and to allow users hooks to know when this happens. Currently only ReqWrap and HandleWrap are covered. Full support will be added in the future for all the *Wrap classes. This comes with a new API: * process.createAsyncListener(listener, callbacks, domain): This will create an AsyncListener instance that can be added and removed when necessary. The "domain" passed will propagate to each callback unless the listener at some point returns a new object. Returns the new AsyncListener instance. * process.addAsyncListener(listener, callbacks, domain): Will create a new AsyncListener instance and immediately add it to the listening queue. Returns the new AsyncListener instance. * process.removeAsyncListener(instance): Remove an AsycListener instance from the current queue and stack. Returns undefined. Explanations for each callback: * listener(): Callback that's called immediately when a *Wrap, Timer or nextTick is queued. * callbacks.before(context, domain): Run immediately before the async callback is about to run. "context" is the "this" of the caller, except in the case of nextTick. Where the callback object is passed instead. "domain" is the object passed to createAsyncListener() or returned from listener(). * callbacks.after(context, domain): Same as before(), except run immediately after the callback has run. Except if the callback has thrown, in which case this will not be called. * callbacks.error(domain, error): Called when a callback has thrown. Currently the "context" is lost in this case so it's not passed, but the "domain" object still is. If the error is properly handled the return true to continue program execution. If multiple error handlers are queued all will be called, and if any one returns true then the error is assumed to have been handled. In the case of callbacks, they are only allowed to throw two levels deep. Afterwards the error handler will always return false. This is to prevent infinite recursive throws. As you'll see, the domain module still exists. Full support has been added in it's previous form until a complete solution is patched. The goal is to have the domain module use AsyncListeners and be as far removed from core as possible. When that day comes, I'll fully enjoy torching every last line of integrated code until it's all burnt stubble.
-
async-wrap: integrate with WeakObject
Making WeakObject inherit from AsyncWrap allows us to peak into almost all the MakeCallback calls in Node internals.
-
async-wrap: add prototype methods to udp/tcp/pipe
Now it's possible to add/remove an async listener to an individual handle created by UDP, TCP or Pipe.
-
crypto: make RandomBytesRequest a class
Since RandomBytesRequest make a call to MakeCallback, I needed it to be a class so AsyncWrap could handle any async listeners. Also added a simple test for an issue had during implementation where the memory was being released and returned.
-
crypto: convert pbkdf2_req to a class
pbkdf2_req has been renamed to PBKDF2Request and converted to a class. It now uses AsyncWrap::MakeCallback. Also includes, using env()->ondone_string() instead of "ondone" and using malloc instead of new char[].
-
-
timers: add/remove listener after creation
To accomplish the after callback running in a setInterval, when clearInterval was run within the callback, the method is run inside a process.nextTick.
-
-
domain: remove domain code from src/
Much of domain functionality can be achieved by async listeners, so they have been refactored to use them. There are two cases (one in net.js and other in _http_client.js) where the handle isn't created until after the instantiation of the event. So it was necessary to add a check if domains exist, then attach the domain's listener to the handle at time of creation. Because the async listener handles errors at the point of asynchronous entry, the need to enter/exit a domain in the event emitter was no longer needed.
-
doc: add some info about AsyncListeners
More information and some examples are necessary.
-
Commits on Oct 18, 2013
-
-
weak-object: Dispose() on self
Also included assert on AsyncWrap that makes sure that persistent().IsEmpty().
Commits on Oct 21, 2013
Commits on Oct 22, 2013
Commits on Oct 23, 2013
-
SQUASH: fix errorHandler so exit event fires
And some other misc stuff that'll need to be squashed.
Commits on Oct 29, 2013
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 48d05e9f1017^...30902485c4c1