Skip to content

Commit

Permalink
async_hooks: remove deprecated APIs
Browse files Browse the repository at this point in the history
These APIs were introduced during the lifetime of Node 8 in an
experimental API and should safely be removable in Node 9+.

PR-URL: #14414
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
addaleax committed Jul 27, 2017
1 parent 2e7ccc2 commit d731369
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 57 deletions.
6 changes: 3 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ The DebugContext will be removed in V8 soon and will not be available in Node
<a id="DEP0070"></a>
### DEP0070: async_hooks.currentId()

Type: Runtime
Type: End-of-Life

`async_hooks.currentId()` was renamed to `async_hooks.executionAsyncId()` for
clarity.
Expand All @@ -617,7 +617,7 @@ clarity.
<a id="DEP0071"></a>
### DEP0071: async_hooks.triggerId()

Type: Runtime
Type: End-of-Life

`async_hooks.triggerId()` was renamed to `async_hooks.triggerAsyncId()` for
clarity.
Expand All @@ -627,7 +627,7 @@ clarity.
<a id="DEP0072"></a>
### DEP0072: async_hooks.AsyncResource.triggerId()

Type: Runtime
Type: End-of-Life

`async_hooks.AsyncResource.triggerId()` was renamed to
`async_hooks.AsyncResource.triggerAsyncId()` for clarity.
Expand Down
32 changes: 0 additions & 32 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const internalUtil = require('internal/util');
const async_wrap = process.binding('async_wrap');
/* Both these arrays are used to communicate between JS and C++ with as little
* overhead as possible.
Expand Down Expand Up @@ -245,17 +244,6 @@ class AsyncResource {
}


// triggerId was renamed to triggerAsyncId. This was in 8.2.0 during the
// experimental stage so the alias can be removed at any time, we are just
// being nice :)
Object.defineProperty(AsyncResource.prototype, 'triggerId', {
get: internalUtil.deprecate(function() {
return AsyncResource.prototype.triggerAsyncId;
}, 'AsyncResource.triggerId is deprecated. ' +
'Use AsyncResource.triggerAsyncId instead.', 'DEP0072')
});


function runInAsyncIdScope(asyncId, cb) {
// Store the async id now to make sure the stack is still good when the ids
// are popped off the stack.
Expand Down Expand Up @@ -462,23 +450,3 @@ module.exports = {
emitAfter: emitAfterScript,
emitDestroy: emitDestroyScript,
};

// currentId was renamed to executionAsyncId. This was in 8.2.0 during the
// experimental stage so the alias can be removed at any time, we are just
// being nice :)
Object.defineProperty(module.exports, 'currentId', {
get: internalUtil.deprecate(function() {
return executionAsyncId;
}, 'async_hooks.currentId is deprecated. ' +
'Use async_hooks.executionAsyncId instead.', 'DEP0070')
});

// triggerId was renamed to triggerAsyncId. This was in 8.2.0 during the
// experimental stage so the alias can be removed at any time, we are just
// being nice :)
Object.defineProperty(module.exports, 'triggerId', {
get: internalUtil.deprecate(function() {
return triggerAsyncId;
}, 'async_hooks.triggerId is deprecated. ' +
'Use async_hooks.triggerAsyncId instead.', 'DEP0071')
});
8 changes: 0 additions & 8 deletions src/async-wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -745,19 +745,11 @@ async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) {
return Environment::GetCurrent(isolate)->current_async_id();
}

async_id AsyncHooksGetCurrentId(Isolate* isolate) {
return AsyncHooksGetExecutionAsyncId(isolate);
}


async_id AsyncHooksGetTriggerAsyncId(Isolate* isolate) {
return Environment::GetCurrent(isolate)->trigger_id();
}

async_id AsyncHooksGetTriggerId(Isolate* isolate) {
return AsyncHooksGetTriggerAsyncId(isolate);
}


async_context EmitAsyncInit(Isolate* isolate,
Local<Object> resource,
Expand Down
14 changes: 0 additions & 14 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,17 +533,9 @@ NODE_EXTERN void AddPromiseHook(v8::Isolate* isolate,
* zero then no execution has been set. This will happen if the user handles
* I/O from native code. */
NODE_EXTERN async_id AsyncHooksGetExecutionAsyncId(v8::Isolate* isolate);
/* legacy alias */
NODE_EXTERN NODE_DEPRECATED("Use AsyncHooksGetExecutionAsyncId(isolate)",
async_id AsyncHooksGetCurrentId(v8::Isolate* isolate));


/* Return same value as async_hooks.triggerAsyncId(); */
NODE_EXTERN async_id AsyncHooksGetTriggerAsyncId(v8::Isolate* isolate);
/* legacy alias */
NODE_EXTERN NODE_DEPRECATED("Use AsyncHooksGetTriggerAsyncId(isolate)",
async_id AsyncHooksGetTriggerId(v8::Isolate* isolate));


/* If the native API doesn't inherit from the helper class then the callbacks
* must be triggered manually. This triggers the init() callback. The return
Expand Down Expand Up @@ -643,12 +635,6 @@ class AsyncResource {
return resource_.Get(isolate_);
}

NODE_DEPRECATED("Use AsyncResource::get_async_id()",
async_id get_uid() const {
return get_async_id();
}
)

async_id get_async_id() const {
return async_context_.async_id;
}
Expand Down

0 comments on commit d731369

Please sign in to comment.