@@ -113,9 +113,7 @@ static Persistent<String> listeners_symbol;
113
113
static Persistent<String> uncaught_exception_symbol;
114
114
static Persistent<String> emit_symbol;
115
115
116
- static Persistent<String> enter_symbol;
117
- static Persistent<String> exit_symbol;
118
- static Persistent<String> disposed_symbol;
116
+ static Persistent<Function> process_makeCallback;
119
117
120
118
121
119
static bool print_eval = false ;
@@ -1010,42 +1008,27 @@ MakeCallback(const Handle<Object> object,
1010
1008
1011
1009
TryCatch try_catch;
1012
1010
1013
- if (enter_symbol.IsEmpty ()) {
1014
- enter_symbol = NODE_PSYMBOL (" enter" );
1015
- exit_symbol = NODE_PSYMBOL (" exit" );
1016
- disposed_symbol = NODE_PSYMBOL (" _disposed" );
1017
- }
1018
-
1019
- Local<Value> domain_v = object->Get (domain_symbol);
1020
- Local<Object> domain;
1021
- Local<Function> enter;
1022
- Local<Function> exit;
1023
- if (!domain_v->IsUndefined ()) {
1024
- domain = domain_v->ToObject ();
1025
- if (domain->Get (disposed_symbol)->BooleanValue ()) {
1026
- // domain has been disposed of.
1027
- return Undefined ();
1011
+ if (process_makeCallback.IsEmpty ()) {
1012
+ Local<Value> cb_v = process->Get (String::New (" _makeCallback" ));
1013
+ if (!cb_v->IsFunction ()) {
1014
+ fprintf (stderr, " process._makeCallback assigned to non-function\n " );
1015
+ abort ();
1028
1016
}
1029
- enter = Local <Function>:: Cast (domain-> Get (enter_symbol) );
1030
- enter-> Call (domain, 0 , NULL );
1017
+ Local<Function> cb = cb_v. As <Function>( );
1018
+ process_makeCallback = Persistent<Function>:: New (cb );
1031
1019
}
1032
1020
1033
- if (try_catch. HasCaught ()) {
1034
- FatalException (try_catch);
1035
- return Undefined ( );
1021
+ Local<Array> argArray = Array::New (argc);
1022
+ for ( int i = 0 ; i < argc; i++) {
1023
+ argArray-> Set ( Integer::New (i), argv[i] );
1036
1024
}
1037
1025
1038
- Local<Value> ret = callback->Call (object, argc, argv);
1026
+ Local<Value> object_l = Local<Value>::New (object);
1027
+ Local<Value> callback_l = Local<Value>::New (callback);
1039
1028
1040
- if (try_catch.HasCaught ()) {
1041
- FatalException (try_catch);
1042
- return Undefined ();
1043
- }
1029
+ Local<Value> args[3 ] = { object_l, callback_l, argArray };
1044
1030
1045
- if (!domain_v->IsUndefined ()) {
1046
- exit = Local<Function>::Cast (domain->Get (exit_symbol));
1047
- exit->Call (domain, 0 , NULL );
1048
- }
1031
+ Local<Value> ret = process_makeCallback->Call (process, ARRAY_SIZE (args), args);
1049
1032
1050
1033
if (try_catch.HasCaught ()) {
1051
1034
FatalException (try_catch);
@@ -1858,9 +1841,6 @@ void FatalException(TryCatch &try_catch) {
1858
1841
ReportException (event_try_catch, true );
1859
1842
exit (1 );
1860
1843
}
1861
-
1862
- // This makes sure uncaught exceptions don't interfere with process.nextTick
1863
- StartTickSpinner ();
1864
1844
}
1865
1845
1866
1846
0 commit comments