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

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

Issue 29434561: Noissue - [emscripten] Call the correct constructor for strings created from JavaScript (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Created May 9, 2017, 10:37 a.m.
Right Patch Set: Added comment Created Aug. 23, 2017, 10:26 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | compiled/bindings/runtime_utils.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 case TypeCategory::INT64: 220 case TypeCategory::INT64:
221 return " var result = Runtime.makeBigInt(" + call_str + ", " + 221 return " var result = Runtime.makeBigInt(" + call_str + ", " +
222 "Runtime.getTempRet0(), " + 222 "Runtime.getTempRet0(), " +
223 "true);\n"; 223 "true);\n";
224 case TypeCategory::DEPENDENT_STRING: 224 case TypeCategory::DEPENDENT_STRING:
225 { 225 {
226 std::string result; 226 std::string result;
227 result += " var string = createString();\n"; 227 result += " var string = createString();\n";
228 result += " " + call_str + ";\n"; 228 result += " " + call_str + ";\n";
229 result += " var result = readString(string);\n"; 229 result += " var result = readString(string);\n";
230 // We don't call a destructor here because we know that dependent
231 // strings don't need to clean up.
230 return result; 232 return result;
sergei 2017/08/23 10:06:15 Strictly speaking, despite destructor of Dependent
Wladimir Palant 2017/08/23 10:26:41 Ok, I added a comment. In fact, we might need to c
sergei 2017/08/23 10:39:19 Yeah, I thought about similar debug needs too. If
231 } 233 }
232 case TypeCategory::OWNED_STRING: 234 case TypeCategory::OWNED_STRING:
233 { 235 {
234 std::string result; 236 std::string result;
235 result += " var string = createOwnedString();\n"; 237 result += " var string = createOwnedString();\n";
236 result += " " + call_str + ";\n"; 238 result += " " + call_str + ";\n";
237 result += " var result = readString(string);\n"; 239 result += " var result = readString(string);\n";
sergei 2017/08/23 10:06:15 Since anyway we have separate calls of Module._Ini
Wladimir Palant 2017/08/23 10:26:41 I tried that but it makes the code here less obvio
sergei 2017/08/23 10:39:19 Acknowledged.
238 result += " Module._DestroyString(string);\n"; 240 result += " Module._DestroyString(string);\n";
239 return result; 241 return result;
240 } 242 }
241 case TypeCategory::STRING_REF: 243 case TypeCategory::STRING_REF:
242 return " var result = readString(" + call_str + ");\n"; 244 return " var result = readString(" + call_str + ");\n";
243 case TypeCategory::CLASS_PTR: 245 case TypeCategory::CLASS_PTR:
244 { 246 {
245 std::string result; 247 std::string result;
246 result += " var result = " + call_str + ";\n"; 248 result += " var result = " + call_str + ";\n";
247 result += " if (result)\n"; 249 result += " if (result)\n";
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 461
460 void printBindings() 462 void printBindings()
461 { 463 {
462 bindings_internal::printHelpers(); 464 bindings_internal::printHelpers();
463 465
464 for (const auto& cls : classes) 466 for (const auto& cls : classes)
465 bindings_internal::printClass(cls); 467 bindings_internal::printClass(cls);
466 for (const auto& cls : classes) 468 for (const auto& cls : classes)
467 bindings_internal::printClassMapping(cls); 469 bindings_internal::printClassMapping(cls);
468 } 470 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld