Make Session trackable

This commit is contained in:
Cheng Zhao 2015-06-24 15:37:04 +08:00
parent 1023b67d59
commit 0ebd4d04ad
7 changed files with 27 additions and 16 deletions

View file

@ -68,6 +68,7 @@ class ResolveProxyHelper {
Session::Session(AtomBrowserContext* browser_context)
: browser_context_(browser_context) {
AttachAsUserData(browser_context);
}
Session::~Session() {
@ -93,9 +94,13 @@ mate::ObjectTemplateBuilder Session::GetObjectTemplateBuilder(
}
// static
mate::Handle<Session> Session::Create(
mate::Handle<Session> Session::CreateFrom(
v8::Isolate* isolate,
AtomBrowserContext* browser_context) {
auto existing = TrackableObject::FromWrappedClass(isolate, browser_context);
if (existing)
return mate::CreateHandle(isolate, static_cast<Session*>(existing));
return mate::CreateHandle(isolate, new Session(browser_context));
}