diff options
Diffstat (limited to 'system')
-rwxr-xr-x | system/include/emscripten/bind.h | 74 | ||||
-rwxr-xr-x | system/lib/embind/bind.cpp | 8 |
2 files changed, 0 insertions, 82 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index b17488b9..894586a6 100755 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -1249,80 +1249,6 @@ namespace emscripten { typename std::aligned_storage<sizeof(T)>::type data; }; } - - //////////////////////////////////////////////////////////////////////////////// - // NEW INTERFACE - //////////////////////////////////////////////////////////////////////////////// - - class JSInterface { - public: - JSInterface(internal::EM_VAL handle) { - initialize(handle); - } - - JSInterface(const JSInterface& obj) - : jsobj(obj.jsobj) - {} - - template<typename ReturnType, typename... Args> - ReturnType call(const char* name, Args... args) { - assertInitialized(); - return Caller<ReturnType, Args...>::call(*jsobj, name, args...); - } - - static std::shared_ptr<JSInterface> cloneToSharedPtr(const JSInterface& i) { - return std::make_shared<JSInterface>(i); - } - - private: - void initialize(internal::EM_VAL handle) { - if (jsobj) { - internal::_embind_fatal_error( - "Cannot initialize interface wrapper twice", - "JSInterface"); - } - jsobj = val::take_ownership(handle); - } - - // this class only exists because you can't partially specialize function templates - template<typename ReturnType, typename... Args> - struct Caller { - static ReturnType call(val& v, const char* name, Args... args) { - return v.call(name, args...).template as<ReturnType>(); - } - }; - - template<typename... Args> - struct Caller<void, Args...> { - static void call(val& v, const char* name, Args... args) { - v.call_void(name, args...); - } - }; - - void assertInitialized() { - if (!jsobj) { - internal::_embind_fatal_error( - "Cannot invoke call on uninitialized Javascript interface wrapper.", "JSInterface"); - } - } - - internal::optional<val> jsobj; - }; - - namespace internal { - extern JSInterface* create_js_interface(EM_VAL e); - } - - class register_js_interface { - public: - register_js_interface() { - _embind_register_interface( - internal::TypeID<JSInterface>::get(), - "JSInterface", - reinterpret_cast<internal::GenericFunction>(&internal::create_js_interface), - reinterpret_cast<internal::GenericFunction>(&internal::raw_destructor<JSInterface>)); - } - }; } namespace emscripten { diff --git a/system/lib/embind/bind.cpp b/system/lib/embind/bind.cpp index 6cacf1e2..35d99dad 100755 --- a/system/lib/embind/bind.cpp +++ b/system/lib/embind/bind.cpp @@ -36,14 +36,6 @@ extern "C" { }
}
-namespace emscripten {
- namespace internal {
- JSInterface* create_js_interface(EM_VAL e) {
- return new JSInterface(e);
- }
- }
-}
-
// TODO: fix in library.js or a proper emscripten libc
extern "C" wchar_t *wmemset(wchar_t *dest, wchar_t c, size_t count) {
wchar_t *o = dest;
|