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

Side by Side Diff: tracing/tracing/importer/simple_line_reader.html

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (Closed)
Patch Set: rebase Created 3 years, 8 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
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 <link rel="import" href="/tracing/base/base.html"> 7 <link rel="import" href="/tracing/base/base.html">
8 <script> 8 <script>
9 'use strict'; 9 'use strict';
10 10
11 tr.exportTo('tr.importer', function() { 11 tr.exportTo('tr.importer', function() {
12 /** 12 /**
13 * @constructor 13 * @constructor
14 */ 14 */
15 function SimpleLineReader(text) { 15 function SimpleLineReader(text) {
16 this.lines_ = text.split('\n'); 16 this.lines_ = text.split('\n');
17 this.curLine_ = 0; 17 this.curLine_ = 0;
18 18
19 this.savedLines_ = undefined; 19 this.savedLines_ = undefined;
20 } 20 }
21 21
22 SimpleLineReader.prototype = { 22 SimpleLineReader.prototype = {
23 advanceToLineMatching: function(regex) { 23 advanceToLineMatching: function(regex) {
24 for (; this.curLine_ < this.lines_.length; this.curLine_++) { 24 for (; this.curLine_ < this.lines_.length; this.curLine_++) {
25 var line = this.lines_[this.curLine_]; 25 var line = this.lines_[this.curLine_];
26 if (this.savedLines_ !== undefined) 26 if (this.savedLines_ !== undefined) {
27 this.savedLines_.push(line); 27 this.savedLines_.push(line);
28 if (regex.test(line)) 28 }
29 return true; 29 if (regex.test(line)) return true;
30 } 30 }
31 return false; 31 return false;
32 }, 32 },
33 33
34 get curLineNumber() { 34 get curLineNumber() {
35 return this.curLine_; 35 return this.curLine_;
36 }, 36 },
37 37
38 beginSavingLines: function() { 38 beginSavingLines: function() {
39 this.savedLines_ = []; 39 this.savedLines_ = [];
40 }, 40 },
41 41
42 endSavingLinesAndGetResult: function() { 42 endSavingLinesAndGetResult: function() {
43 var tmp = this.savedLines_; 43 var tmp = this.savedLines_;
44 this.savedLines_ = undefined; 44 this.savedLines_ = undefined;
45 return tmp; 45 return tmp;
46 } 46 }
47 }; 47 };
48 48
49 return { 49 return {
50 SimpleLineReader, 50 SimpleLineReader,
51 }; 51 };
52 }); 52 });
53 </script> 53 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/importer/proto_expectation.html ('k') | tracing/tracing/metrics/blink/gc_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698