mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Move a few more global vars into struct
This commit is contained in:
1 parent
e10fd321e4
commit
cced79d4a8
4 files changed
+27
-18
No files matched your search
+5
-5
@@ -48,6 +48,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include <node_vars.h>
|
||||
#define oncomplete_sym NODE_VAR(oncomplete_sym)
|
||||
#define ares_channel NODE_VAR(ares_channel)
|
||||
|
||||
|
||||
namespace node {
|
||||
|
||||
namespace cares_wrap {
|
||||
@@ -69,11 +74,6 @@ using v8::Value;
|
||||
|
||||
typedef class ReqWrap<uv_getaddrinfo_t> GetAddrInfoReqWrap;
|
||||
|
||||
static Persistent<String> oncomplete_sym;
|
||||
|
||||
static ares_channel ares_channel;
|
||||
|
||||
|
||||
static Local<Array> HostentToAddresses(struct hostent* host) {
|
||||
HandleScope scope;
|
||||
Local<Array> addresses = Array::New();
|
||||
|
||||
+7
-11
@@ -131,6 +131,12 @@ extern char **environ;
|
||||
#define use_debug_agent NODE_VAR(use_debug_agent)
|
||||
#define use_npn NODE_VAR(use_npn)
|
||||
#define use_sni NODE_VAR(use_sni)
|
||||
#define uncaught_exception_counter NODE_VAR(uncaught_exception_counter)
|
||||
#define debug_watcher NODE_VAR(debug_watcher)
|
||||
#define binding_cache NODE_VAR(binding_cache)
|
||||
#define module_load_list NODE_VAR(module_load_list)
|
||||
#define node_isolate NODE_VAR(node_isolate)
|
||||
#define debugger_running NODE_VAR(debugger_running)
|
||||
|
||||
|
||||
namespace node {
|
||||
@@ -1685,7 +1691,6 @@ static void OnFatalError(const char* location, const char* message) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int uncaught_exception_counter = 0;
|
||||
|
||||
void FatalException(TryCatch &try_catch) {
|
||||
HandleScope scope;
|
||||
@@ -1738,8 +1743,6 @@ void FatalException(TryCatch &try_catch) {
|
||||
}
|
||||
|
||||
|
||||
static uv_async_t debug_watcher;
|
||||
|
||||
static void DebugMessageCallback(uv_async_t* watcher, int status) {
|
||||
HandleScope scope;
|
||||
assert(watcher == &debug_watcher);
|
||||
@@ -1762,9 +1765,6 @@ static void DebugBreakMessageHandler(const Debug::Message& message) {
|
||||
}
|
||||
|
||||
|
||||
Persistent<Object> binding_cache;
|
||||
Persistent<Array> module_load_list;
|
||||
|
||||
static Handle<Value> Binding(const Arguments& args) {
|
||||
HandleScope scope;
|
||||
|
||||
@@ -2256,9 +2256,6 @@ static void ParseArgs(int argc, char **argv) {
|
||||
}
|
||||
|
||||
|
||||
static Isolate* node_isolate = NULL;
|
||||
static volatile bool debugger_running = false;
|
||||
|
||||
static void EnableDebug(bool wait_connect) {
|
||||
// If we're called from another thread, make sure to enter the right
|
||||
// v8 isolate.
|
||||
@@ -2561,8 +2558,7 @@ char** Init(int argc, char *argv[]) {
|
||||
// main thread to execute a random bit of javascript - which will give V8
|
||||
// control so it can handle whatever new message had been received on the
|
||||
// debug thread.
|
||||
uv_async_init(uv_default_loop(), &node::debug_watcher,
|
||||
node::DebugMessageCallback);
|
||||
uv_async_init(uv_default_loop(), &debug_watcher, node::DebugMessageCallback);
|
||||
// unref it so that we exit the event loop despite it being active.
|
||||
uv_unref(uv_default_loop());
|
||||
|
||||
|
||||
@@ -64,6 +64,14 @@ struct globals {
|
||||
# define RPM_SAMPLES 100
|
||||
int64_t tick_times[RPM_SAMPLES];
|
||||
int tick_time_head;
|
||||
int uncaught_exception_counter;
|
||||
uv_async_t debug_watcher;
|
||||
v8::Persistent<v8::Object> binding_cache;
|
||||
v8::Persistent<v8::Array> module_load_list;
|
||||
v8::Isolate* node_isolate;
|
||||
volatile bool debugger_running;
|
||||
|
||||
|
||||
|
||||
// stream_wrap.cc
|
||||
size_t slab_used;
|
||||
@@ -179,6 +187,9 @@ struct globals {
|
||||
// node_signal_watcher.cc
|
||||
v8::Persistent<v8::String> callback_symbol;
|
||||
v8::Persistent<v8::FunctionTemplate> signal_watcher_constructor_template;
|
||||
|
||||
// cares_wrap.cc
|
||||
::ares_channel ares_channel;
|
||||
};
|
||||
|
||||
struct globals* globals_get();
|
||||
|
||||
@@ -36,13 +36,15 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <node_vars.h>
|
||||
#define process_title NODE_VAR(process_title)
|
||||
|
||||
namespace node {
|
||||
|
||||
using namespace v8;
|
||||
|
||||
static char *process_title;
|
||||
double Platform::prog_start_time = Platform::GetUptime();
|
||||
|
||||
char** Platform::SetupArgs(int argc, char *argv[]) {
|
||||
|
||||
Reference in new issue
Block a user