From 8cd4612fe08e66e0621e4a146af7136d7034641d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 2 Aug 2016 17:02:04 +0900 Subject: [PATCH] Get rid of Constructor class --- atom/browser/api/atom_api_menu.cc | 9 +++++---- atom/browser/api/atom_api_tray.cc | 9 +++++---- atom/browser/api/atom_api_window.cc | 6 +++--- atom/common/api/atom_api_key_weak_map.h | 1 + vendor/native_mate | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/atom/browser/api/atom_api_menu.cc b/atom/browser/api/atom_api_menu.cc index b7fc230651c6..3c8cb0e1d357 100644 --- a/atom/browser/api/atom_api_menu.cc +++ b/atom/browser/api/atom_api_menu.cc @@ -185,14 +185,15 @@ void Menu::BuildPrototype(v8::Isolate* isolate, namespace { +using atom::api::Menu; + void Initialize(v8::Local exports, v8::Local unused, v8::Local context, void* priv) { - using atom::api::Menu; v8::Isolate* isolate = context->GetIsolate(); - v8::Local constructor = mate::CreateConstructor( - isolate, "Menu", base::Bind(&Menu::New)); + Menu::SetConstructor(isolate, "Menu", base::Bind(&Menu::New)); + mate::Dictionary dict(isolate, exports); - dict.Set("Menu", static_cast>(constructor)); + dict.Set("Menu", Menu::GetConstructor(isolate)); #if defined(OS_MACOSX) dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu); dict.SetMethod("sendActionToFirstResponder", diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index de11f7874861..a9870300a557 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -222,14 +222,15 @@ void Tray::BuildPrototype(v8::Isolate* isolate, namespace { +using atom::api::Tray; + void Initialize(v8::Local exports, v8::Local unused, v8::Local context, void* priv) { - using atom::api::Tray; v8::Isolate* isolate = context->GetIsolate(); - v8::Local constructor = mate::CreateConstructor( - isolate, "Tray", base::Bind(&Tray::New)); + Tray::SetConstructor(isolate, "Tray", base::Bind(&Tray::New)); + mate::Dictionary dict(isolate, exports); - dict.Set("Tray", static_cast>(constructor)); + dict.Set("Tray", Tray::GetConstructor(isolate)); } } // namespace diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 19d88ec33118..8433730fb107 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -869,9 +869,9 @@ using atom::api::Window; void Initialize(v8::Local exports, v8::Local unused, v8::Local context, void* priv) { v8::Isolate* isolate = context->GetIsolate(); - v8::Local constructor = mate::CreateConstructor( - isolate, "BrowserWindow", base::Bind(&Window::New)); - mate::Dictionary browser_window(isolate, constructor); + Window::SetConstructor(isolate, "BrowserWindow", base::Bind(&Window::New)); + + mate::Dictionary browser_window(isolate, Window::GetConstructor(isolate)); browser_window.SetMethod("fromId", &mate::TrackableObject::FromWeakMapID); browser_window.SetMethod("getAllWindows", diff --git a/atom/common/api/atom_api_key_weak_map.h b/atom/common/api/atom_api_key_weak_map.h index b13338badd5b..021b690e398f 100644 --- a/atom/common/api/atom_api_key_weak_map.h +++ b/atom/common/api/atom_api_key_weak_map.h @@ -8,6 +8,7 @@ #include "atom/common/key_weak_map.h" #include "native_mate/object_template_builder.h" #include "native_mate/handle.h" +#include "native_mate/wrappable.h" namespace atom { diff --git a/vendor/native_mate b/vendor/native_mate index ab62755a886d..2d26eebca8d6 160000 --- a/vendor/native_mate +++ b/vendor/native_mate @@ -1 +1 @@ -Subproject commit ab62755a886d424727f4959f4339555865490ae8 +Subproject commit 2d26eebca8d6e0e8fdfdf68197699ae78018fbda