Get rid of Constructor class

This commit is contained in:
Cheng Zhao 2016-08-02 17:02:04 +09:00
parent 846ec5ba49
commit 8cd4612fe0
5 changed files with 15 additions and 12 deletions

View file

@ -185,14 +185,15 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
namespace {
using atom::api::Menu;
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
using atom::api::Menu;
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<Menu>(
isolate, "Menu", base::Bind(&Menu::New));
Menu::SetConstructor(isolate, "Menu", base::Bind(&Menu::New));
mate::Dictionary dict(isolate, exports);
dict.Set("Menu", static_cast<v8::Local<v8::Value>>(constructor));
dict.Set("Menu", Menu::GetConstructor(isolate));
#if defined(OS_MACOSX)
dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu);
dict.SetMethod("sendActionToFirstResponder",

View file

@ -222,14 +222,15 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
namespace {
using atom::api::Tray;
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
using atom::api::Tray;
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<Tray>(
isolate, "Tray", base::Bind(&Tray::New));
Tray::SetConstructor(isolate, "Tray", base::Bind(&Tray::New));
mate::Dictionary dict(isolate, exports);
dict.Set("Tray", static_cast<v8::Local<v8::Value>>(constructor));
dict.Set("Tray", Tray::GetConstructor(isolate));
}
} // namespace

View file

@ -869,9 +869,9 @@ using atom::api::Window;
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<Window>(
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<Window>::FromWeakMapID);
browser_window.SetMethod("getAllWindows",

View file

@ -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 {

2
vendor/native_mate vendored

@ -1 +1 @@
Subproject commit ab62755a886d424727f4959f4339555865490ae8
Subproject commit 2d26eebca8d6e0e8fdfdf68197699ae78018fbda