diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 0d06b392b8..6ea5464d6f 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -109,8 +109,9 @@ int DockBounce(const std::string& type) { } #endif -void Initialize(v8::Handle exports) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + v8::Isolate* isolate = context->GetIsolate(); Browser* browser = Browser::Get(); CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -140,4 +141,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_browser_app, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_app, Initialize) diff --git a/atom/browser/api/atom_api_auto_updater.cc b/atom/browser/api/atom_api_auto_updater.cc index 65842b21e9..b76b1ef762 100644 --- a/atom/browser/api/atom_api_auto_updater.cc +++ b/atom/browser/api/atom_api_auto_updater.cc @@ -85,12 +85,13 @@ mate::Handle AutoUpdater::Create(v8::Isolate* isolate) { namespace { -void Initialize(v8::Handle exports) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + v8::Isolate* isolate = context->GetIsolate(); mate::Dictionary dict(isolate, exports); dict.Set("autoUpdater", atom::api::AutoUpdater::Create(isolate)); } } // namespace -NODE_MODULE_X(atom_browser_auto_updater, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_auto_updater, Initialize) diff --git a/atom/browser/api/atom_api_dialog.cc b/atom/browser/api/atom_api_dialog.cc index 217aab0c79..ffc0160339 100644 --- a/atom/browser/api/atom_api_dialog.cc +++ b/atom/browser/api/atom_api_dialog.cc @@ -76,8 +76,9 @@ void ShowSaveDialog(const std::string& title, } } -void Initialize(v8::Handle exports) { - mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + mate::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("showMessageBox", &ShowMessageBox); dict.SetMethod("showOpenDialog", &ShowOpenDialog); dict.SetMethod("showSaveDialog", &ShowSaveDialog); @@ -85,4 +86,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_browser_dialog, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_dialog, Initialize) diff --git a/atom/browser/api/atom_api_menu.cc b/atom/browser/api/atom_api_menu.cc index 73464456d4..a6d729254c 100644 --- a/atom/browser/api/atom_api_menu.cc +++ b/atom/browser/api/atom_api_menu.cc @@ -262,9 +262,10 @@ void Menu::BuildPrototype(v8::Isolate* isolate, namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { using atom::api::Menu; - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = context->GetIsolate(); v8::Local constructor = mate::CreateConstructor( isolate, "Menu", base::Bind(&Menu::Create)); mate::Dictionary dict(isolate, exports); @@ -278,4 +279,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_browser_menu, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_menu, Initialize) diff --git a/atom/browser/api/atom_api_power_monitor.cc b/atom/browser/api/atom_api_power_monitor.cc index 4ceb2a168b..ecfb3fdfc3 100644 --- a/atom/browser/api/atom_api_power_monitor.cc +++ b/atom/browser/api/atom_api_power_monitor.cc @@ -49,13 +49,14 @@ mate::Handle PowerMonitor::Create(v8::Isolate* isolate) { namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { #if defined(OS_MACOSX) base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); #endif using atom::api::PowerMonitor; - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = context->GetIsolate(); mate::Handle power_monitor = PowerMonitor::Create(isolate); mate::Dictionary dict(isolate, exports); dict.Set("powerMonitor", power_monitor); @@ -63,4 +64,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_browser_power_monitor, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_power_monitor, Initialize) diff --git a/atom/browser/api/atom_api_protocol.cc b/atom/browser/api/atom_api_protocol.cc index 4eeca5ab9c..29ec8507c5 100644 --- a/atom/browser/api/atom_api_protocol.cc +++ b/atom/browser/api/atom_api_protocol.cc @@ -322,16 +322,17 @@ mate::Handle Protocol::Create(v8::Isolate* isolate) { namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { // Make sure the job factory has been created. atom::AtomBrowserContext::Get()->url_request_context_getter()-> GetURLRequestContext(); - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = context->GetIsolate(); mate::Dictionary dict(isolate, exports); dict.Set("protocol", atom::api::Protocol::Create(isolate)); } } // namespace -NODE_MODULE_X(atom_browser_protocol, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_protocol, Initialize) diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 32fa4ee620..86e6cb2995 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -69,9 +69,10 @@ void Tray::BuildPrototype(v8::Isolate* isolate, namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { using atom::api::Tray; - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = context->GetIsolate(); v8::Handle constructor = mate::CreateConstructor( isolate, "Tray", base::Bind(&Tray::New)); mate::Dictionary dict(isolate, exports); @@ -80,4 +81,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_browser_tray, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_tray, Initialize) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 1f87e549da..278a929a81 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -388,9 +388,10 @@ void Window::BuildPrototype(v8::Isolate* isolate, namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { using atom::api::Window; - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = context->GetIsolate(); v8::Local constructor = mate::CreateConstructor( isolate, "BrowserWindow", base::Bind(&Window::New)); mate::Dictionary dict(isolate, exports); @@ -399,4 +400,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_browser_window, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_window, Initialize) diff --git a/atom/common/api/atom_api_clipboard.cc b/atom/common/api/atom_api_clipboard.cc index 64e53a78cd..e5cc30905b 100644 --- a/atom/common/api/atom_api_clipboard.cc +++ b/atom/common/api/atom_api_clipboard.cc @@ -67,8 +67,9 @@ void Clear(ui::ClipboardType type) { ui::Clipboard::GetForCurrentThread()->Clear(type); } -void Initialize(v8::Handle exports) { - mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + mate::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("_has", &Has); dict.SetMethod("_read", &Read); dict.SetMethod("_readText", &ReadText); @@ -78,4 +79,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_common_clipboard, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_clipboard, Initialize) diff --git a/atom/common/api/atom_api_crash_reporter.cc b/atom/common/api/atom_api_crash_reporter.cc index 2bd5ce4342..06ce7fadba 100644 --- a/atom/common/api/atom_api_crash_reporter.cc +++ b/atom/common/api/atom_api_crash_reporter.cc @@ -35,9 +35,10 @@ struct Converter > { namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { using crash_reporter::CrashReporter; - mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); + mate::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("start", base::Bind(&CrashReporter::Start, base::Unretained(CrashReporter::GetInstance()))); @@ -45,4 +46,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_common_crash_reporter, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_crash_reporter, Initialize) diff --git a/atom/common/api/atom_api_id_weak_map.cc b/atom/common/api/atom_api_id_weak_map.cc index 3461f0e0b1..652e8f75cc 100644 --- a/atom/common/api/atom_api_id_weak_map.cc +++ b/atom/common/api/atom_api_id_weak_map.cc @@ -91,10 +91,10 @@ void IDWeakMap::WeakCallback( namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { using atom::api::IDWeakMap; - - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = context->GetIsolate(); v8::Local constructor = mate::CreateConstructor( isolate, "IDWeakMap", @@ -104,4 +104,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_common_id_weak_map, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_id_weak_map, Initialize) diff --git a/atom/common/api/atom_api_screen.cc b/atom/common/api/atom_api_screen.cc index 547adc4a28..9f77863450 100644 --- a/atom/common/api/atom_api_screen.cc +++ b/atom/common/api/atom_api_screen.cc @@ -86,13 +86,14 @@ struct Converter { namespace { -void Initialize(v8::Handle exports) { +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { #if defined(TOOLKIT_GTK) gfx::GdkInitFromCommandLine(*CommandLine::ForCurrentProcess()); #endif gfx::Screen* screen = gfx::Screen::GetNativeScreen(); - mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); + mate::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("getCursorScreenPoint", base::Bind(&gfx::Screen::GetCursorScreenPoint, base::Unretained(screen))); @@ -103,4 +104,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_common_screen, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_screen, Initialize) diff --git a/atom/common/api/atom_api_shell.cc b/atom/common/api/atom_api_shell.cc index d88a0e4c8e..876e448240 100644 --- a/atom/common/api/atom_api_shell.cc +++ b/atom/common/api/atom_api_shell.cc @@ -13,8 +13,9 @@ namespace { -void Initialize(v8::Handle exports) { - mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + mate::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder); dict.SetMethod("openItem", &platform_util::OpenItem); dict.SetMethod("openExternal", &platform_util::OpenExternal); @@ -24,4 +25,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_common_shell, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_shell, Initialize) diff --git a/atom/common/api/atom_api_v8_util.cc b/atom/common/api/atom_api_v8_util.cc index f585df720e..4332d029c2 100644 --- a/atom/common/api/atom_api_v8_util.cc +++ b/atom/common/api/atom_api_v8_util.cc @@ -43,8 +43,9 @@ void TakeHeapSnapshot(v8::Isolate* isolate) { mate::StringToV8(isolate, "test")); } -void Initialize(v8::Handle exports) { - mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + mate::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("createObjectWithName", &CreateObjectWithName); dict.SetMethod("getHiddenValue", &GetHiddenValue); dict.SetMethod("setHiddenValue", &SetHiddenValue); @@ -55,4 +56,4 @@ void Initialize(v8::Handle exports) { } // namespace -NODE_MODULE_X(atom_common_v8_util, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_v8_util, Initialize) diff --git a/atom/renderer/api/atom_api_renderer_ipc.cc b/atom/renderer/api/atom_api_renderer_ipc.cc index baf9ec606c..678a0c7e1f 100644 --- a/atom/renderer/api/atom_api_renderer_ipc.cc +++ b/atom/renderer/api/atom_api_renderer_ipc.cc @@ -62,12 +62,13 @@ base::string16 SendSync(const base::string16& channel, return json; } -void Initialize(v8::Handle exports) { - mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + mate::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("send", &Send); dict.SetMethod("sendSync", &SendSync); } } // namespace -NODE_MODULE_X(atom_renderer_ipc, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_renderer_ipc, Initialize) diff --git a/atom/renderer/api/atom_api_web_view.cc b/atom/renderer/api/atom_api_web_view.cc index 81ce35521c..1f983cdf96 100644 --- a/atom/renderer/api/atom_api_web_view.cc +++ b/atom/renderer/api/atom_api_web_view.cc @@ -69,12 +69,13 @@ mate::Handle WebView::Create(v8::Isolate* isolate) { namespace { -void Initialize(v8::Handle exports) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); +void Initialize(v8::Handle exports, v8::Handle unused, + v8::Handle context, void* priv) { + v8::Isolate* isolate = context->GetIsolate(); mate::Dictionary dict(isolate, exports); dict.Set("webView", atom::api::WebView::Create(isolate)); } } // namespace -NODE_MODULE_X(atom_renderer_web_view, Initialize, NULL, NM_F_BUILTIN) +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_renderer_web_view, Initialize)