summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2014-01-03 14:02:51 -0800
committerTrevor Norris <trev.norris@gmail.com>2014-01-09 13:47:03 -0800
commit646ac18d7933412dae672d6826154c1eb08d4e82 (patch)
treeae952bc8ba9dbe5c1f8b5b0c010c1fcd1cd1da94 /src/env.h
parent828f14556e0daeae7fdac08fceaa90952de63f73 (diff)
downloadnode-646ac18d7933412dae672d6826154c1eb08d4e82.tar.gz
node: AsyncListener use separate storage mechanism
Before when an AsyncListener object was created and the "create" callback returned a value, it was necessary to construct a new Object with the same callbacks but add a place for the new storage value. Now, instead, a separate storage array is kept on the context which is used for any return value of the "create" callback. This significantly reduces the number of Objects that need to be created. Also added a flags property to the context to quickly check if a specific callback was available either on the context or on the AsyncListener instance itself. Few other minor changes for readability that were difficult to separate into their own commit. This has not been optimized yet.
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/env.h b/src/env.h
index 71936dd5c..b654ea2d0 100644
--- a/src/env.h
+++ b/src/env.h
@@ -177,14 +177,14 @@ class Environment {
public:
inline uint32_t* fields();
inline int fields_count() const;
- inline uint32_t count() const;
+ inline bool has_listener() const;
private:
friend class Environment; // So we can call the constructor.
inline AsyncListener();
enum Fields {
- kCount,
+ kHasListener,
kFieldsCount
};
@@ -253,7 +253,7 @@ class Environment {
inline v8::Isolate* isolate() const;
inline uv_loop_t* event_loop() const;
- inline bool has_async_listeners() const;
+ inline bool has_async_listener() const;
inline bool in_domain() const;
static inline Environment* from_immediate_check_handle(uv_check_t* handle);