Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/bindings/runtime_utils.cpp

Issue 29410617: Issue 5131 - [emscripten] Clean separation of bindings code and runtime code (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Rebased Created April 13, 2017, 1:08 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/bindings/main.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « compiled/bindings/main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld