OLD | NEW |
(Empty) | |
| 1 #include <emscripten.h> |
| 2 |
| 3 #include "../intrusive_ptr.h" |
| 4 #include "../String.h" |
| 5 |
| 6 extern "C" |
| 7 { |
| 8 void EMSCRIPTEN_KEEPALIVE InitString(DependentString* str, |
| 9 String::value_type* data, String::size_type len) |
| 10 { |
| 11 // String is already allocated on stack, we merely need to call |
| 12 // constructor. |
| 13 new (str) DependentString(data, len); |
| 14 } |
| 15 |
| 16 void EMSCRIPTEN_KEEPALIVE DestroyString(OwnedString* str) |
| 17 { |
| 18 // Stack memory will be freed automatically, we need to call |
| 19 // destructor explicitly however. |
| 20 str->~OwnedString(); |
| 21 } |
| 22 |
| 23 String::size_type EMSCRIPTEN_KEEPALIVE GetStringLength( |
| 24 const String& str) |
| 25 { |
| 26 return str.length(); |
| 27 } |
| 28 |
| 29 const String::value_type* EMSCRIPTEN_KEEPALIVE GetStringData( |
| 30 const String& str) |
| 31 { |
| 32 return str.data(); |
| 33 } |
| 34 |
| 35 void EMSCRIPTEN_KEEPALIVE ReleaseRef(ref_counted* ptr) |
| 36 { |
| 37 ptr->ReleaseRef(); |
| 38 } |
| 39 } |
OLD | NEW |