Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: mojo/public/js/unicode.js

Issue 703273002: Update mojo sdk to rev 04a510fb37db10642e156957f9b2c11c2f6442ac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix content/child -> mojo/common linking Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Defines functions for translating between JavaScript strings and UTF8 strings 6 * Defines functions for translating between JavaScript strings and UTF8 strings
7 * stored in ArrayBuffers. There is much room for optimization in this code if 7 * stored in ArrayBuffers. There is much room for optimization in this code if
8 * it proves necessary. 8 * it proves necessary.
9 */ 9 */
10 define("mojo/public/js/bindings/unicode", function() { 10 define("mojo/public/js/unicode", function() {
11 /** 11 /**
12 * Decodes the UTF8 string from the given buffer. 12 * Decodes the UTF8 string from the given buffer.
13 * @param {ArrayBufferView} buffer The buffer containing UTF8 string data. 13 * @param {ArrayBufferView} buffer The buffer containing UTF8 string data.
14 * @return {string} The corresponding JavaScript string. 14 * @return {string} The corresponding JavaScript string.
15 */ 15 */
16 function decodeUtf8String(buffer) { 16 function decodeUtf8String(buffer) {
17 return decodeURIComponent(escape(String.fromCharCode.apply(null, buffer))); 17 return decodeURIComponent(escape(String.fromCharCode.apply(null, buffer)));
18 } 18 }
19 19
20 /** 20 /**
(...skipping 21 matching lines...) Expand all
42 var utf8String = unescape(encodeURIComponent(str)); 42 var utf8String = unescape(encodeURIComponent(str));
43 return utf8String.length; 43 return utf8String.length;
44 } 44 }
45 45
46 var exports = {}; 46 var exports = {};
47 exports.decodeUtf8String = decodeUtf8String; 47 exports.decodeUtf8String = decodeUtf8String;
48 exports.encodeUtf8String = encodeUtf8String; 48 exports.encodeUtf8String = encodeUtf8String;
49 exports.utf8Length = utf8Length; 49 exports.utf8Length = utf8Length;
50 return exports; 50 return exports;
51 }); 51 });
OLDNEW
« no previous file with comments | « mojo/public/js/test/validation_test_input_parser.js ('k') | mojo/public/js/validation_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698