SetClassName on internal classes.

This commit is contained in:
Ryan Dahl 2009-10-03 15:08:03 +02:00
parent b66c5c9808
commit 602f9dbf3f
6 changed files with 11 additions and 0 deletions

View File

@ -23,6 +23,7 @@ void ChildProcess::Initialize(Handle<Object> target) {
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->Inherit(EventEmitter::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
constructor_template->SetClassName(String::NewSymbol("ChildProcess"));
NODE_SET_PROTOTYPE_METHOD(constructor_template, "spawn", ChildProcess::Spawn);
NODE_SET_PROTOTYPE_METHOD(constructor_template, "write", ChildProcess::Write);

View File

@ -38,6 +38,7 @@ void EventEmitter::Initialize(Local<FunctionTemplate> ctemplate) {
Local<FunctionTemplate> __emit = FunctionTemplate::New(Emit);
constructor_template->PrototypeTemplate()->Set(String::NewSymbol("emit"),
__emit);
constructor_template->SetClassName(String::NewSymbol("EventEmitter"));
// All other prototype methods are defined in events.js
@ -116,6 +117,7 @@ void Promise::Initialize(v8::Handle<v8::Object> target) {
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->Inherit(EventEmitter::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
constructor_template->SetClassName(String::NewSymbol("Promise"));
NODE_SET_PROTOTYPE_METHOD(constructor_template, "block", Block);
NODE_SET_PROTOTYPE_METHOD(constructor_template, "emitSuccess", EmitSuccess);

View File

@ -382,6 +382,8 @@ void File::Initialize(Handle<Object> target) {
Promise::constructor_template);
EIOPromise::constructor_template->InstanceTemplate()->
SetInternalFieldCount(1);
EIOPromise::constructor_template->SetClassName(
String::NewSymbol("EIOPromise"));
target->Set(String::NewSymbol("EIOPromise"),
EIOPromise::constructor_template->GetFunction());
}

View File

@ -26,12 +26,14 @@ HTTPConnection::Initialize (Handle<Object> target)
client_constructor_template = Persistent<FunctionTemplate>::New(t);
client_constructor_template->Inherit(Connection::constructor_template);
client_constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
client_constructor_template->SetClassName(String::NewSymbol("Client"));
target->Set(String::NewSymbol("Client"), client_constructor_template->GetFunction());
t = FunctionTemplate::New(NewServer);
server_constructor_template = Persistent<FunctionTemplate>::New(t);
server_constructor_template->Inherit(Connection::constructor_template);
server_constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
server_constructor_template->SetClassName(String::NewSymbol("ServerSideConnection"));
}
Handle<Value>
@ -206,6 +208,7 @@ HTTPServer::Initialize (Handle<Object> target)
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->Inherit(Server::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
constructor_template->SetClassName(String::NewSymbol("Server"));
target->Set(String::NewSymbol("Server"), constructor_template->GetFunction());
}

View File

@ -55,6 +55,7 @@ void Connection::Initialize(v8::Handle<v8::Object> target) {
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->Inherit(EventEmitter::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
constructor_template->SetClassName(String::NewSymbol("Connection"));
NODE_SET_PROTOTYPE_METHOD(constructor_template, "connect", Connect);
NODE_SET_PROTOTYPE_METHOD(constructor_template, "send", Send);
@ -422,6 +423,7 @@ void Server::Initialize(Handle<Object> target) {
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->Inherit(EventEmitter::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
constructor_template->SetClassName(String::NewSymbol("Server"));
NODE_SET_PROTOTYPE_METHOD(constructor_template, "listen", Listen);
NODE_SET_PROTOTYPE_METHOD(constructor_template, "close", Close);

View File

@ -18,6 +18,7 @@ Timer::Initialize (Handle<Object> target)
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->Inherit(EventEmitter::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
constructor_template->SetClassName(String::NewSymbol("Timer"));
NODE_SET_PROTOTYPE_METHOD(constructor_template, "start", Timer::Start);
NODE_SET_PROTOTYPE_METHOD(constructor_template, "stop", Timer::Stop);