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.
This commit is contained in:
Kevin Sawicki
2012-08-22 15:08:36 -07:00
parent d665b39db7
commit b3200a944f
3 changed files with 105 additions and 13 deletions

View File

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