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

Delta Between Two Patch Sets: compiled/bindings/runtime_utils.cpp

Issue 29425555: Issue 5201 - [emscripten] Replace EM_ASM calls by a custom JavaScript library (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Moved all declarations into a single header and corrected emscripten.h includes Created April 30, 2017, 3:14 p.m.
Right Patch Set: Abstracted away all Emscripten dependencies Created May 3, 2017, 11:54 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/bindings/runtime.h ('k') | compiled/debug.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 #include <emscripten.h> 1 #include "runtime.h"
2
3 #include "../intrusive_ptr.h" 2 #include "../intrusive_ptr.h"
4 #include "../String.h" 3 #include "../String.h"
5 4
6 extern "C" 5 extern "C"
7 { 6 {
8 void EMSCRIPTEN_KEEPALIVE InitString(DependentString* str, 7 void BINDINGS_EXPORTED InitString(DependentString* str,
9 String::value_type* data, String::size_type len) 8 String::value_type* data, String::size_type len)
10 { 9 {
11 // String is already allocated on stack, we merely need to call 10 // String is already allocated on stack, we merely need to call
12 // constructor. 11 // constructor.
13 new (str) DependentString(data, len); 12 new (str) DependentString(data, len);
14 } 13 }
15 14
16 void EMSCRIPTEN_KEEPALIVE DestroyString(OwnedString* str) 15 void BINDINGS_EXPORTED DestroyString(OwnedString* str)
17 { 16 {
18 // Stack memory will be freed automatically, we need to call 17 // Stack memory will be freed automatically, we need to call
19 // destructor explicitly however. 18 // destructor explicitly however.
20 str->~OwnedString(); 19 str->~OwnedString();
21 } 20 }
22 21
23 String::size_type EMSCRIPTEN_KEEPALIVE GetStringLength( 22 String::size_type BINDINGS_EXPORTED GetStringLength(
24 const String& str) 23 const String& str)
25 { 24 {
26 return str.length(); 25 return str.length();
27 } 26 }
28 27
29 const String::value_type* EMSCRIPTEN_KEEPALIVE GetStringData( 28 const String::value_type* BINDINGS_EXPORTED GetStringData(
30 const String& str) 29 const String& str)
31 { 30 {
32 return str.data(); 31 return str.data();
33 } 32 }
34 33
35 void EMSCRIPTEN_KEEPALIVE ReleaseRef(ref_counted* ptr) 34 void BINDINGS_EXPORTED ReleaseRef(ref_counted* ptr)
36 { 35 {
37 ptr->ReleaseRef(); 36 ptr->ReleaseRef();
38 } 37 }
39 } 38 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld