From: Cheng Zhao Date: Thu, 25 Apr 2013 12:23:00 +0000 (+0800) Subject: Notify creation and destruction of native objects. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bcfec7c8cde3bab41a4c6be9e9e2eee9bd4e332f;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Notify creation and destruction of native objects. --- diff --git a/browser/api/atom_api_event_emitter.cc b/browser/api/atom_api_event_emitter.cc index 6fe790b..ae39a7c 100644 --- a/browser/api/atom_api_event_emitter.cc +++ b/browser/api/atom_api_event_emitter.cc @@ -11,6 +11,8 @@ #include "base/values.h" #include "browser/api/atom_api_event.h" #include "common/v8_value_converter_impl.h" +#include "vendor/node/src/node.h" +#include "vendor/node/src/node_internals.h" namespace atom { @@ -18,9 +20,22 @@ namespace api { EventEmitter::EventEmitter(v8::Handle wrapper) { Wrap(wrapper); + + // process.emit('ATOM_BROWSER_INTERNAL_NEW', this). + v8::Handle args[] = { + v8::String::New("ATOM_BROWSER_INTERNAL_NEW"), + wrapper, + }; + node::MakeCallback(node::process, "emit", 2, args); } EventEmitter::~EventEmitter() { + // process.emit('ATOM_BROWSER_INTERNAL_DELETE', this). + v8::Handle args[] = { + v8::String::New("ATOM_BROWSER_INTERNAL_DELETE"), + handle_, + }; + node::MakeCallback(node::process, "emit", 2, args); } bool EventEmitter::Emit(const std::string& name, base::ListValue* args) {