diff options
author | Timothy Gu <timothygu99@gmail.com> | 2017-07-13 12:53:01 +0800 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2017-10-02 21:38:15 -0700 |
commit | 2f8ddb27340a5e7e914dc1160846d4822e6352a2 (patch) | |
tree | d5fd763a90ee913f25a51047a76f5aa485769660 /lib/inspector.js | |
parent | 71578198e30344140c237ec36fb706419c398440 (diff) | |
download | android-node-v8-2f8ddb27340a5e7e914dc1160846d4822e6352a2.tar.gz android-node-v8-2f8ddb27340a5e7e914dc1160846d4822e6352a2.tar.bz2 android-node-v8-2f8ddb27340a5e7e914dc1160846d4822e6352a2.zip |
inspector: reimplement JS binding
- Group all relevant methods/states into a C++ class.
- Uses internal fields instead of the less efficient v8::External for
storing the pointer to the C++ object.
- Use AsyncWrap to allow instrumenting callback states.
PR-URL: https://github.com/nodejs/node/pull/15643
Refs: https://github.com/nodejs/node/issues/13503
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/inspector.js')
-rw-r--r-- | lib/inspector.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/inspector.js b/lib/inspector.js index adbb0afaa5..5aacdde26b 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -2,9 +2,9 @@ const EventEmitter = require('events'); const util = require('util'); -const { connect, open, url } = process.binding('inspector'); +const { Connection, open, url } = process.binding('inspector'); -if (!connect) +if (!Connection) throw new Error('Inspector is not available'); const connectionSymbol = Symbol('connectionProperty'); @@ -24,7 +24,7 @@ class Session extends EventEmitter { if (this[connectionSymbol]) throw new Error('Already connected'); this[connectionSymbol] = - connect((message) => this[onMessageSymbol](message)); + new Connection((message) => this[onMessageSymbol](message)); } [onMessageSymbol](message) { |