GCC Code Coverage Report
Directory: ../src/ Exec Total Coverage
File: /home/node-core-coverage/node-core-coverage/workdir/node/out/../src/env.h Lines: 4 4 100.0 %
Date: 2016-12-18 Branches: 0 0 0.0 %

Line Branch Exec Source
1
#ifndef SRC_ENV_H_
2
#define SRC_ENV_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "ares.h"
7
#include "debug-agent.h"
8
#if HAVE_INSPECTOR
9
#include "inspector_agent.h"
10
#endif
11
#include "handle_wrap.h"
12
#include "req-wrap.h"
13
#include "tree.h"
14
#include "util.h"
15
#include "uv.h"
16
#include "v8.h"
17
18
#include <stdint.h>
19
#include <vector>
20
21
// Caveat emptor: we're going slightly crazy with macros here but the end
22
// hopefully justifies the means. We have a lot of per-context properties
23
// and adding and maintaining their getters and setters by hand would be
24
// a nightmare so let's make the preprocessor generate them for us.
25
//
26
// Make sure that any macros defined here are undefined again at the bottom
27
// of context-inl.h. The exceptions are NODE_CONTEXT_EMBEDDER_DATA_INDEX
28
// and NODE_ISOLATE_SLOT, they may have been defined externally.
29
namespace node {
30
31
// Pick an index that's hopefully out of the way when we're embedded inside
32
// another application. Performance-wise or memory-wise it doesn't matter:
33
// Context::SetAlignedPointerInEmbedderData() is backed by a FixedArray,
34
// worst case we pay a one-time penalty for resizing the array.
35
#ifndef NODE_CONTEXT_EMBEDDER_DATA_INDEX
36
#define NODE_CONTEXT_EMBEDDER_DATA_INDEX 32
37
#endif
38
39
// The slot 0 and 1 had already been taken by "gin" and "blink" in Chrome,
40
// and the size of isolate's slots is 4 by default, so using 3 should
41
// hopefully make node work independently when embedded into other
42
// application.
43
#ifndef NODE_ISOLATE_SLOT
44
#define NODE_ISOLATE_SLOT 3
45
#endif
46
47
// The number of items passed to push_values_to_array_function has diminishing
48
// returns around 8. This should be used at all call sites using said function.
49
#ifndef NODE_PUSH_VAL_TO_ARRAY_MAX
50
#define NODE_PUSH_VAL_TO_ARRAY_MAX 8
51
#endif
52
53
// Private symbols are per-isolate primitives but Environment proxies them
54
// for the sake of convenience.  Strings should be ASCII-only and have a
55
// "node:" prefix to avoid name clashes with third-party code.
56
#define PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V)                              \
57
  V(alpn_buffer_private_symbol, "node:alpnBuffer")                            \
58
  V(arrow_message_private_symbol, "node:arrowMessage")                        \
59
  V(contextify_context_private_symbol, "node:contextify:context")             \
60
  V(contextify_global_private_symbol, "node:contextify:global")               \
61
  V(decorated_private_symbol, "node:decorated")                               \
62
  V(npn_buffer_private_symbol, "node:npnBuffer")                              \
63
  V(processed_private_symbol, "node:processed")                               \
64
  V(selected_npn_buffer_private_symbol, "node:selectedNpnBuffer")             \
65
66
// Strings are per-isolate primitives but Environment proxies them
67
// for the sake of convenience.  Strings should be ASCII-only.
68
#define PER_ISOLATE_STRING_PROPERTIES(V)                                      \
69
  V(address_string, "address")                                                \
70
  V(args_string, "args")                                                      \
71
  V(async, "async")                                                           \
72
  V(async_queue_string, "_asyncQueue")                                        \
73
  V(buffer_string, "buffer")                                                  \
74
  V(bytes_string, "bytes")                                                    \
75
  V(bytes_parsed_string, "bytesParsed")                                       \
76
  V(bytes_read_string, "bytesRead")                                           \
77
  V(cached_data_string, "cachedData")                                         \
78
  V(cached_data_produced_string, "cachedDataProduced")                        \
79
  V(cached_data_rejected_string, "cachedDataRejected")                        \
80
  V(callback_string, "callback")                                              \
81
  V(change_string, "change")                                                  \
82
  V(oncertcb_string, "oncertcb")                                              \
83
  V(onclose_string, "_onclose")                                               \
84
  V(code_string, "code")                                                      \
85
  V(cwd_string, "cwd")                                                        \
86
  V(dest_string, "dest")                                                      \
87
  V(detached_string, "detached")                                              \
88
  V(disposed_string, "_disposed")                                             \
89
  V(domain_string, "domain")                                                  \
90
  V(emitting_top_level_domain_error_string, "_emittingTopLevelDomainError")   \
91
  V(exchange_string, "exchange")                                              \
92
  V(idle_string, "idle")                                                      \
93
  V(irq_string, "irq")                                                        \
94
  V(encoding_string, "encoding")                                              \
95
  V(enter_string, "enter")                                                    \
96
  V(env_pairs_string, "envPairs")                                             \
97
  V(errno_string, "errno")                                                    \
98
  V(error_string, "error")                                                    \
99
  V(events_string, "_events")                                                 \
100
  V(exiting_string, "_exiting")                                               \
101
  V(exit_code_string, "exitCode")                                             \
102
  V(exit_string, "exit")                                                      \
103
  V(expire_string, "expire")                                                  \
104
  V(exponent_string, "exponent")                                              \
105
  V(exports_string, "exports")                                                \
106
  V(ext_key_usage_string, "ext_key_usage")                                    \
107
  V(external_string, "external")                                              \
108
  V(external_stream_string, "_externalStream")                                \
109
  V(family_string, "family")                                                  \
110
  V(fatal_exception_string, "_fatalException")                                \
111
  V(fd_string, "fd")                                                          \
112
  V(file_string, "file")                                                      \
113
  V(fingerprint_string, "fingerprint")                                        \
114
  V(flags_string, "flags")                                                    \
115
  V(gid_string, "gid")                                                        \
116
  V(handle_string, "handle")                                                  \
117
  V(heap_total_string, "heapTotal")                                           \
118
  V(heap_used_string, "heapUsed")                                             \
119
  V(homedir_string, "homedir")                                                \
120
  V(hostmaster_string, "hostmaster")                                          \
121
  V(ignore_string, "ignore")                                                  \
122
  V(immediate_callback_string, "_immediateCallback")                          \
123
  V(infoaccess_string, "infoAccess")                                          \
124
  V(inherit_string, "inherit")                                                \
125
  V(input_string, "input")                                                    \
126
  V(internal_string, "internal")                                              \
127
  V(ipv4_string, "IPv4")                                                      \
128
  V(ipv6_string, "IPv6")                                                      \
129
  V(isalive_string, "isAlive")                                                \
130
  V(isclosing_string, "isClosing")                                            \
131
  V(issuer_string, "issuer")                                                  \
132
  V(issuercert_string, "issuerCertificate")                                   \
133
  V(kill_signal_string, "killSignal")                                         \
134
  V(mac_string, "mac")                                                        \
135
  V(max_buffer_string, "maxBuffer")                                           \
136
  V(message_string, "message")                                                \
137
  V(minttl_string, "minttl")                                                  \
138
  V(model_string, "model")                                                    \
139
  V(modulus_string, "modulus")                                                \
140
  V(name_string, "name")                                                      \
141
  V(netmask_string, "netmask")                                                \
142
  V(nice_string, "nice")                                                      \
143
  V(nsname_string, "nsname")                                                  \
144
  V(ocsp_request_string, "OCSPRequest")                                       \
145
  V(onchange_string, "onchange")                                              \
146
  V(onclienthello_string, "onclienthello")                                    \
147
  V(oncomplete_string, "oncomplete")                                          \
148
  V(onconnection_string, "onconnection")                                      \
149
  V(ondone_string, "ondone")                                                  \
150
  V(onerror_string, "onerror")                                                \
151
  V(onexit_string, "onexit")                                                  \
152
  V(onhandshakedone_string, "onhandshakedone")                                \
153
  V(onhandshakestart_string, "onhandshakestart")                              \
154
  V(onmessage_string, "onmessage")                                            \
155
  V(onnewsession_string, "onnewsession")                                      \
156
  V(onnewsessiondone_string, "onnewsessiondone")                              \
157
  V(onocspresponse_string, "onocspresponse")                                  \
158
  V(onread_string, "onread")                                                  \
159
  V(onreadstart_string, "onreadstart")                                        \
160
  V(onreadstop_string, "onreadstop")                                          \
161
  V(onselect_string, "onselect")                                              \
162
  V(onshutdown_string, "onshutdown")                                          \
163
  V(onsignal_string, "onsignal")                                              \
164
  V(onstop_string, "onstop")                                                  \
165
  V(onwrite_string, "onwrite")                                                \
166
  V(output_string, "output")                                                  \
167
  V(order_string, "order")                                                    \
168
  V(owner_string, "owner")                                                    \
169
  V(parse_error_string, "Parse Error")                                        \
170
  V(path_string, "path")                                                      \
171
  V(pbkdf2_error_string, "PBKDF2 Error")                                      \
172
  V(pid_string, "pid")                                                        \
173
  V(pipe_string, "pipe")                                                      \
174
  V(port_string, "port")                                                      \
175
  V(preference_string, "preference")                                          \
176
  V(priority_string, "priority")                                              \
177
  V(produce_cached_data_string, "produceCachedData")                          \
178
  V(raw_string, "raw")                                                        \
179
  V(readable_string, "readable")                                              \
180
  V(received_shutdown_string, "receivedShutdown")                             \
181
  V(refresh_string, "refresh")                                                \
182
  V(regexp_string, "regexp")                                                  \
183
  V(rename_string, "rename")                                                  \
184
  V(replacement_string, "replacement")                                        \
185
  V(retry_string, "retry")                                                    \
186
  V(rss_string, "rss")                                                        \
187
  V(serial_string, "serial")                                                  \
188
  V(scopeid_string, "scopeid")                                                \
189
  V(sent_shutdown_string, "sentShutdown")                                     \
190
  V(serial_number_string, "serialNumber")                                     \
191
  V(service_string, "service")                                                \
192
  V(servername_string, "servername")                                          \
193
  V(session_id_string, "sessionId")                                           \
194
  V(shell_string, "shell")                                                    \
195
  V(signal_string, "signal")                                                  \
196
  V(size_string, "size")                                                      \
197
  V(sni_context_err_string, "Invalid SNI context")                            \
198
  V(sni_context_string, "sni_context")                                        \
199
  V(speed_string, "speed")                                                    \
200
  V(stack_string, "stack")                                                    \
201
  V(status_string, "status")                                                  \
202
  V(stdio_string, "stdio")                                                    \
203
  V(subject_string, "subject")                                                \
204
  V(subjectaltname_string, "subjectaltname")                                  \
205
  V(sys_string, "sys")                                                        \
206
  V(syscall_string, "syscall")                                                \
207
  V(tick_callback_string, "_tickCallback")                                    \
208
  V(tick_domain_cb_string, "_tickDomainCallback")                             \
209
  V(ticketkeycallback_string, "onticketkeycallback")                          \
210
  V(timeout_string, "timeout")                                                \
211
  V(times_string, "times")                                                    \
212
  V(tls_ticket_string, "tlsTicket")                                           \
213
  V(type_string, "type")                                                      \
214
  V(uid_string, "uid")                                                        \
215
  V(unknown_string, "<unknown>")                                              \
216
  V(user_string, "user")                                                      \
217
  V(username_string, "username")                                              \
218
  V(valid_from_string, "valid_from")                                          \
219
  V(valid_to_string, "valid_to")                                              \
220
  V(verify_error_string, "verifyError")                                       \
221
  V(version_string, "version")                                                \
222
  V(weight_string, "weight")                                                  \
223
  V(windows_verbatim_arguments_string, "windowsVerbatimArguments")            \
224
  V(wrap_string, "wrap")                                                      \
225
  V(writable_string, "writable")                                              \
226
  V(write_queue_size_string, "writeQueueSize")                                \
227
  V(x_forwarded_string, "x-forwarded-for")                                    \
228
  V(zero_return_string, "ZERO_RETURN")                                        \
229
230
#define ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)                           \
231
  V(as_external, v8::External)                                                \
232
  V(async_hooks_destroy_function, v8::Function)                               \
233
  V(async_hooks_init_function, v8::Function)                                  \
234
  V(async_hooks_post_function, v8::Function)                                  \
235
  V(async_hooks_pre_function, v8::Function)                                   \
236
  V(binding_cache_object, v8::Object)                                         \
237
  V(buffer_constructor_function, v8::Function)                                \
238
  V(buffer_prototype_object, v8::Object)                                      \
239
  V(context, v8::Context)                                                     \
240
  V(domain_array, v8::Array)                                                  \
241
  V(domains_stack_array, v8::Array)                                           \
242
  V(fs_stats_constructor_function, v8::Function)                              \
243
  V(generic_internal_field_template, v8::ObjectTemplate)                      \
244
  V(jsstream_constructor_template, v8::FunctionTemplate)                      \
245
  V(module_load_list_array, v8::Array)                                        \
246
  V(pipe_constructor_template, v8::FunctionTemplate)                          \
247
  V(process_object, v8::Object)                                               \
248
  V(promise_reject_function, v8::Function)                                    \
249
  V(push_values_to_array_function, v8::Function)                              \
250
  V(script_context_constructor_template, v8::FunctionTemplate)                \
251
  V(script_data_constructor_function, v8::Function)                           \
252
  V(secure_context_constructor_template, v8::FunctionTemplate)                \
253
  V(tcp_constructor_template, v8::FunctionTemplate)                           \
254
  V(tick_callback_function, v8::Function)                                     \
255
  V(tls_wrap_constructor_function, v8::Function)                              \
256
  V(tls_wrap_constructor_template, v8::FunctionTemplate)                      \
257
  V(tty_constructor_template, v8::FunctionTemplate)                           \
258
  V(udp_constructor_function, v8::Function)                                   \
259
  V(write_wrap_constructor_function, v8::Function)                            \
260
261
class Environment;
262
263
struct node_ares_task {
264
  Environment* env;
265
  ares_socket_t sock;
266
  uv_poll_t poll_watcher;
267
  RB_ENTRY(node_ares_task) node;
268
};
269
270
RB_HEAD(node_ares_task_list, node_ares_task);
271
272
class IsolateData {
273
 public:
274
  inline IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop,
275
                     uint32_t* zero_fill_field = nullptr);
276
  inline uv_loop_t* event_loop() const;
277
  inline uint32_t* zero_fill_field() const;
278
279
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
280
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
281
#define V(TypeName, PropertyName)                                             \
282
  inline v8::Local<TypeName> PropertyName(v8::Isolate* isolate) const;
283
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
284
  PER_ISOLATE_STRING_PROPERTIES(VS)
285
#undef V
286
#undef VS
287
#undef VP
288
289
 private:
290
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
291
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
292
#define V(TypeName, PropertyName)                                             \
293
  v8::Eternal<TypeName> PropertyName ## _;
294
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
295
  PER_ISOLATE_STRING_PROPERTIES(VS)
296
#undef V
297
#undef VS
298
#undef VP
299
300
  uv_loop_t* const event_loop_;
301
  uint32_t* const zero_fill_field_;
302
303
  DISALLOW_COPY_AND_ASSIGN(IsolateData);
304
};
305
306
class Environment {
307
 public:
308
  class AsyncHooks {
309
   public:
310
    inline uint32_t* fields();
311
    inline int fields_count() const;
312
    inline bool callbacks_enabled();
313
    inline void set_enable_callbacks(uint32_t flag);
314
315
   private:
316
    friend class Environment;  // So we can call the constructor.
317
    inline AsyncHooks();
318
319
    enum Fields {
320
      // Set this to not zero if the init hook should be called.
321
      kEnableCallbacks,
322
      kFieldsCount
323
    };
324
325
    uint32_t fields_[kFieldsCount];
326
327
    DISALLOW_COPY_AND_ASSIGN(AsyncHooks);
328
  };
329
330
  class AsyncCallbackScope {
331
   public:
332
    explicit AsyncCallbackScope(Environment* env);
333
    ~AsyncCallbackScope();
334
335
    inline bool in_makecallback();
336
337
   private:
338
    Environment* env_;
339
340
    DISALLOW_COPY_AND_ASSIGN(AsyncCallbackScope);
341
  };
342
343
  class DomainFlag {
344
   public:
345
    inline uint32_t* fields();
346
    inline int fields_count() const;
347
    inline uint32_t count() const;
348
349
   private:
350
    friend class Environment;  // So we can call the constructor.
351
    inline DomainFlag();
352
353
    enum Fields {
354
      kCount,
355
      kFieldsCount
356
    };
357
358
    uint32_t fields_[kFieldsCount];
359
360
    DISALLOW_COPY_AND_ASSIGN(DomainFlag);
361
  };
362
363
  class TickInfo {
364
   public:
365
    inline uint32_t* fields();
366
    inline int fields_count() const;
367
    inline uint32_t index() const;
368
    inline uint32_t length() const;
369
    inline void set_index(uint32_t value);
370
371
   private:
372
    friend class Environment;  // So we can call the constructor.
373
    inline TickInfo();
374
375
    enum Fields {
376
      kIndex,
377
      kLength,
378
      kFieldsCount
379
    };
380
381
    uint32_t fields_[kFieldsCount];
382
383
    DISALLOW_COPY_AND_ASSIGN(TickInfo);
384
  };
385
386
  typedef void (*HandleCleanupCb)(Environment* env,
387
                                  uv_handle_t* handle,
388
                                  void* arg);
389
390
15182
  class HandleCleanup {
391
   private:
392
    friend class Environment;
393
394
    HandleCleanup(uv_handle_t* handle, HandleCleanupCb cb, void* arg)
395
        : handle_(handle),
396
          cb_(cb),
397
17168
          arg_(arg) {
398
    }
399
400
    uv_handle_t* handle_;
401
    HandleCleanupCb cb_;
402
    void* arg_;
403
    ListNode<HandleCleanup> handle_cleanup_queue_;
404
  };
405
406
  static inline Environment* GetCurrent(v8::Isolate* isolate);
407
  static inline Environment* GetCurrent(v8::Local<v8::Context> context);
408
  static inline Environment* GetCurrent(
409
      const v8::FunctionCallbackInfo<v8::Value>& info);
410
411
  template <typename T>
412
  static inline Environment* GetCurrent(
413
      const v8::PropertyCallbackInfo<T>& info);
414
415
  inline Environment(IsolateData* isolate_data, v8::Local<v8::Context> context);
416
  inline ~Environment();
417
418
  void Start(int argc,
419
             const char* const* argv,
420
             int exec_argc,
421
             const char* const* exec_argv,
422
             bool start_profiler_idle_notifier);
423
  void AssignToContext(v8::Local<v8::Context> context);
424
425
  void StartProfilerIdleNotifier();
426
  void StopProfilerIdleNotifier();
427
428
  inline v8::Isolate* isolate() const;
429
  inline uv_loop_t* event_loop() const;
430
  inline bool async_wrap_callbacks_enabled() const;
431
  inline bool in_domain() const;
432
  inline uint32_t watched_providers() const;
433
434
  static inline Environment* from_immediate_check_handle(uv_check_t* handle);
435
  static inline Environment* from_destroy_ids_idle_handle(uv_idle_t* handle);
436
  inline uv_check_t* immediate_check_handle();
437
  inline uv_idle_t* immediate_idle_handle();
438
  inline uv_idle_t* destroy_ids_idle_handle();
439
440
  // Register clean-up cb to be called on environment destruction.
441
  inline void RegisterHandleCleanup(uv_handle_t* handle,
442
                                    HandleCleanupCb cb,
443
                                    void *arg);
444
  inline void FinishHandleCleanup(uv_handle_t* handle);
445
446
  inline AsyncHooks* async_hooks();
447
  inline DomainFlag* domain_flag();
448
  inline TickInfo* tick_info();
449
  inline uint64_t timer_base() const;
450
451
  static inline Environment* from_cares_timer_handle(uv_timer_t* handle);
452
  inline uv_timer_t* cares_timer_handle();
453
  inline ares_channel cares_channel();
454
  inline ares_channel* cares_channel_ptr();
455
  inline node_ares_task_list* cares_task_list();
456
  inline IsolateData* isolate_data() const;
457
458
  inline bool using_domains() const;
459
  inline void set_using_domains(bool value);
460
461
  inline bool printed_error() const;
462
  inline void set_printed_error(bool value);
463
464
  void PrintSyncTrace() const;
465
  inline void set_trace_sync_io(bool value);
466
467
  inline int64_t get_async_wrap_uid();
468
469
  // List of id's that have been destroyed and need the destroy() cb called.
470
  inline std::vector<int64_t>* destroy_ids_list();
471
472
  inline double* heap_statistics_buffer() const;
473
  inline void set_heap_statistics_buffer(double* pointer);
474
475
  inline double* heap_space_statistics_buffer() const;
476
  inline void set_heap_space_statistics_buffer(double* pointer);
477
478
  inline char* http_parser_buffer() const;
479
  inline void set_http_parser_buffer(char* buffer);
480
481
  inline void ThrowError(const char* errmsg);
482
  inline void ThrowTypeError(const char* errmsg);
483
  inline void ThrowRangeError(const char* errmsg);
484
  inline void ThrowErrnoException(int errorno,
485
                                  const char* syscall = nullptr,
486
                                  const char* message = nullptr,
487
                                  const char* path = nullptr);
488
  inline void ThrowUVException(int errorno,
489
                               const char* syscall = nullptr,
490
                               const char* message = nullptr,
491
                               const char* path = nullptr,
492
                               const char* dest = nullptr);
493
494
  inline v8::Local<v8::FunctionTemplate>
495
      NewFunctionTemplate(v8::FunctionCallback callback,
496
                          v8::Local<v8::Signature> signature =
497
                              v8::Local<v8::Signature>());
498
499
  // Convenience methods for NewFunctionTemplate().
500
  inline void SetMethod(v8::Local<v8::Object> that,
501
                        const char* name,
502
                        v8::FunctionCallback callback);
503
  inline void SetProtoMethod(v8::Local<v8::FunctionTemplate> that,
504
                             const char* name,
505
                             v8::FunctionCallback callback);
506
  inline void SetTemplateMethod(v8::Local<v8::FunctionTemplate> that,
507
                                const char* name,
508
                                v8::FunctionCallback callback);
509
510
  inline v8::Local<v8::Object> NewInternalFieldObject();
511
512
  // Strings and private symbols are shared across shared contexts
513
  // The getters simply proxy to the per-isolate primitive.
514
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
515
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
516
#define V(TypeName, PropertyName)                                             \
517
  inline v8::Local<TypeName> PropertyName() const;
518
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
519
  PER_ISOLATE_STRING_PROPERTIES(VS)
520
#undef V
521
#undef VS
522
#undef VP
523
524
#define V(PropertyName, TypeName)                                             \
525
  inline v8::Local<TypeName> PropertyName() const;                            \
526
  inline void set_ ## PropertyName(v8::Local<TypeName> value);
527
  ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
528
#undef V
529
530
  inline debugger::Agent* debugger_agent() {
531
16
    return &debugger_agent_;
532
  }
533
534
#if HAVE_INSPECTOR
535
  inline inspector::Agent* inspector_agent() {
536
1671
    return &inspector_agent_;
537
  }
538
#endif
539
540
  typedef ListHead<HandleWrap, &HandleWrap::handle_wrap_queue_> HandleWrapQueue;
541
  typedef ListHead<ReqWrap<uv_req_t>, &ReqWrap<uv_req_t>::req_wrap_queue_>
542
          ReqWrapQueue;
543
544
  inline HandleWrapQueue* handle_wrap_queue() { return &handle_wrap_queue_; }
545
  inline ReqWrapQueue* req_wrap_queue() { return &req_wrap_queue_; }
546
547
  static const int kContextEmbedderDataIndex = NODE_CONTEXT_EMBEDDER_DATA_INDEX;
548
549
 private:
550
  inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
551
                         const char* errmsg);
552
553
  v8::Isolate* const isolate_;
554
  IsolateData* const isolate_data_;
555
  uv_check_t immediate_check_handle_;
556
  uv_idle_t immediate_idle_handle_;
557
  uv_idle_t destroy_ids_idle_handle_;
558
  uv_prepare_t idle_prepare_handle_;
559
  uv_check_t idle_check_handle_;
560
  AsyncHooks async_hooks_;
561
  DomainFlag domain_flag_;
562
  TickInfo tick_info_;
563
  const uint64_t timer_base_;
564
  uv_timer_t cares_timer_handle_;
565
  ares_channel cares_channel_;
566
  node_ares_task_list cares_task_list_;
567
  bool using_domains_;
568
  bool printed_error_;
569
  bool trace_sync_io_;
570
  size_t makecallback_cntr_;
571
  int64_t async_wrap_uid_;
572
  std::vector<int64_t> destroy_ids_list_;
573
  debugger::Agent debugger_agent_;
574
#if HAVE_INSPECTOR
575
  inspector::Agent inspector_agent_;
576
#endif
577
578
  HandleWrapQueue handle_wrap_queue_;
579
  ReqWrapQueue req_wrap_queue_;
580
  ListHead<HandleCleanup,
581
           &HandleCleanup::handle_cleanup_queue_> handle_cleanup_queue_;
582
  int handle_cleanup_waiting_;
583
584
  double* heap_statistics_buffer_ = nullptr;
585
  double* heap_space_statistics_buffer_ = nullptr;
586
587
  char* http_parser_buffer_;
588
589
#define V(PropertyName, TypeName)                                             \
590
  v8::Persistent<TypeName> PropertyName ## _;
591
  ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
592
#undef V
593
594
  DISALLOW_COPY_AND_ASSIGN(Environment);
595
};
596
597
}  // namespace node
598
599
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
600
601
#endif  // SRC_ENV_H_