From b3200a944fc88a277fce287b1df0b406e864f8e6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 22 Aug 2012 15:08:36 -0700 Subject: [PATCH] Move native function declarations to js file This allows multiple native handlers to load it as an extension without duplicating all the expected native function calls names internally. --- Atom-Linux/native_handler.cpp | 8 +++ Atom/src/native_handler.mm | 16 ++---- src/stdlib/native-handler.js | 94 +++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 src/stdlib/native-handler.js diff --git a/Atom-Linux/native_handler.cpp b/Atom-Linux/native_handler.cpp index 51b08ca3d..9ee59c25f 100644 --- a/Atom-Linux/native_handler.cpp +++ b/Atom-Linux/native_handler.cpp @@ -67,6 +67,14 @@ NativeHandler::NativeHandler() : object->SetValue(functionName, function, V8_PROPERTY_ATTRIBUTE_NONE); } + string nativePath = io_utils_real_app_path( + "/../src/stdlib/native-handler.js"); + if (!nativePath.empty()) { + string extensionCode; + if (io_utils_read(nativePath, &extensionCode) > 0) + CefRegisterExtension("v8/native-handler", extensionCode, this); + } + notifyFd = inotify_init(); if (notifyFd != -1) g_thread_create_full(NotifyWatchersCallback, this, 0, true, false, diff --git a/Atom/src/native_handler.mm b/Atom/src/native_handler.mm index 84f7b1d69..d891189ab 100644 --- a/Atom/src/native_handler.mm +++ b/Atom/src/native_handler.mm @@ -31,19 +31,9 @@ void throwException(const CefRefPtr& global, CefRefPtr