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

Unified Diff: compiled/bindings.ipp

Issue 29384673: Issue 4991 - [emscripten] Update to Emscripten 1.37.3 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Fixed indentation Created March 21, 2017, 10:17 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compile ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/bindings.ipp
===================================================================
--- a/compiled/bindings.ipp
+++ b/compiled/bindings.ipp
@@ -481,60 +481,61 @@ namespace bindings_internal
return result;
}
void printHelpers()
{
printf("var sizeofString = %i;\n", sizeof(String));
puts(R"(
- function copyString(str, buffer)
- {
- var length = str.length;
- for (var i = 0, pointer = (buffer >> 1); i < length; i++, pointer++)
- HEAP16[pointer] = str.charCodeAt(i);
- return length;
- }
-
- function createString(str)
- {
- var length = 0;
- var buffer = 0;
- if (str)
- {
- buffer = Runtime.stackAlloc(str.length * 2);
- length = copyString(str, buffer);
- }
+ function copyString(str, buffer)
+ {
+ var length = str.length;
+ for (var i = 0, pointer = (buffer >> 1); i < length; i++, pointer++)
+ HEAP16[pointer] = str.charCodeAt(i);
+ return length;
+ }
- var result = Module.Runtime.stackAlloc(sizeofString);
- Module._InitString(result, buffer, length);
- return result;
- }
-
- function readString(str)
- {
- var length = Module._GetStringLength(str);
- var pointer = Module._GetStringData(str) >> 1;
- return String.fromCharCode.apply(String, HEAP16.slice(pointer, pointer + length));
- }
+ function createString(str)
+ {
+ var length = 0;
+ var buffer = 0;
+ if (str)
+ {
+ buffer = Runtime.stackAlloc(str.length * 2);
+ length = copyString(str, buffer);
+ }
- function createClass(superclass, ref_counted_offset)
- {
- var result = function(pointer)
- {
- this._pointer = pointer;
- };
- if (superclass)
- result.prototype = Object.create(superclass.prototype);
- result.prototype.delete = function()
- {
- Module._ReleaseRef(this._pointer + ref_counted_offset);
- };
- return result;
- })");
+ var result = Runtime.stackAlloc(sizeofString);
+ Module._InitString(result, buffer, length);
+ return result;
+ }
+
+ function readString(str)
+ {
+ var length = Module._GetStringLength(str);
+ var pointer = Module._GetStringData(str) >> 1;
+ return String.fromCharCode.apply(String, HEAP16.slice(pointer, pointer + length));
+ }
+
+ function createClass(superclass, ref_counted_offset)
+ {
+ var result = function(pointer)
+ {
+ this._pointer = pointer;
+ };
+ if (superclass)
+ result.prototype = Object.create(superclass.prototype);
+ result.prototype.delete = function()
+ {
+ Module._ReleaseRef(this._pointer + ref_counted_offset);
+ };
+ return result;
+ }
+ )");
}
void printClass(const ClassInfo& cls)
{
DifferentiatorInfo differentiator = cls.subclass_differentiator;
if (differentiator.offset != SIZE_MAX)
{
printf("var %s_mapping = \n", cls.name.c_str());
« no previous file with comments | « compile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld