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

Side by Side Diff: tracing/tracing/base/utils.html

Issue 2997213002: Remove unused tr.b.addSingletonGetter. (Closed)
Patch Set: Created 3 years, 4 months 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
« no previous file with comments | « no previous file | 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/base.html"> 8 <link rel="import" href="/tracing/base/base.html">
9 9
10 <script> 10 <script>
11 'use strict'; 11 'use strict';
12 12
13 tr.exportTo('tr.b', function() { 13 tr.exportTo('tr.b', function() {
14 const URL_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2, 6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/; // eslint-disable-line max-len 14 const URL_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2, 6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/; // eslint-disable-line max-len
15 15
16 /**
17 * Adds a {@code getInstance} static method that always return the same
18 * instance object.
19 * @param {!Function} ctor The constructor for the class to add the static
20 * method to.
21 */
22 function addSingletonGetter(ctor) {
23 ctor.getInstance = function() {
24 return ctor.instance_ || (ctor.instance_ = new ctor());
25 };
26 }
27
28 function deepCopy(value) { 16 function deepCopy(value) {
29 if (!(value instanceof Object)) { 17 if (!(value instanceof Object)) {
30 if (value === undefined || value === null) return value; 18 if (value === undefined || value === null) return value;
31 if (typeof value === 'string') return value.substring(); 19 if (typeof value === 'string') return value.substring();
32 if (typeof value === 'boolean') return value; 20 if (typeof value === 'boolean') return value;
33 if (typeof value === 'number') return value; 21 if (typeof value === 'number') return value;
34 throw new Error('Unrecognized: ' + typeof value); 22 throw new Error('Unrecognized: ' + typeof value);
35 } 23 }
36 24
37 const object = value; 25 const object = value;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 170
183 /** 171 /**
184 * @param {string} s 172 * @param {string} s
185 * @return {boolean} 173 * @return {boolean}
186 */ 174 */
187 function isUrl(s) { 175 function isUrl(s) {
188 return typeof(s) === 'string' && s.match(URL_REGEX) !== null; 176 return typeof(s) === 'string' && s.match(URL_REGEX) !== null;
189 } 177 }
190 178
191 return { 179 return {
192 addSingletonGetter,
193 deepCopy, 180 deepCopy,
194 formatDate, 181 formatDate,
195 getUsingPath, 182 getUsingPath,
196 isUrl, 183 isUrl,
197 normalizeException, 184 normalizeException,
198 numberFromJson, 185 numberFromJson,
199 numberToJson, 186 numberToJson,
200 runLengthEncoding, 187 runLengthEncoding,
201 stackTrace, 188 stackTrace,
202 stackTraceAsString, 189 stackTraceAsString,
203 }; 190 };
204 }); 191 });
205 </script> 192 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698