aboutsummaryrefslogtreecommitdiff
path: root/system/include
diff options
context:
space:
mode:
Diffstat (limited to 'system/include')
-rwxr-xr-xsystem/include/emscripten/bind.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index 73a8d4da..3901ce50 100755
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -9,6 +9,7 @@
#include <type_traits>
#include <emscripten/val.h>
#include <emscripten/wire.h>
+#include "northstar/Pointer.h"
namespace emscripten {
enum class sharing_policy {
@@ -705,6 +706,24 @@ namespace emscripten {
};
};
+ template<typename PointeeType>
+ struct smart_ptr_trait<northstar::IntrusivePointer<PointeeType>> {
+ typedef northstar::IntrusivePointer<PointeeType> PointerType;
+ typedef typename PointerType::element_type element_type;
+
+ static element_type* get(const PointerType& ptr) {
+ return ptr.get();
+ }
+
+ static northstar::IntrusivePointer<PointeeType>* share(PointeeType* p, internal::EM_VAL v) {
+ return new northstar::IntrusivePointer<PointeeType>(p);
+ }
+
+ static sharing_policy get_sharing_policy() {
+ return sharing_policy::INTRUSIVE;
+ }
+ };
+
////////////////////////////////////////////////////////////////////////////////
// CLASSES
////////////////////////////////////////////////////////////////////////////////