Chromium Code Reviews| Index: tools/tickprocessor.js |
| diff --git a/tools/tickprocessor.js b/tools/tickprocessor.js |
| index d8575738553aa93f46116489312232d31acf8cf5..f57021a6b2af06760a8bee53f0a56a35fc885315 100644 |
| --- a/tools/tickprocessor.js |
| +++ b/tools/tickprocessor.js |
| @@ -25,12 +25,33 @@ |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| +// Node imports |
| +if (typeof module !== 'undefined' && module.exports) { |
| + Profile = require('./profile'); |
| + LogReader = require('./logreader'); |
| + ProfileView = require('./profile_view').ProfileView; |
| + ViewBuilder = require('./profile_view').ViewBuilder; |
| +} |
| + |
| +// Node polyfill |
| +var os = os || { |
| + system: function(name, args) { |
| + return require('child_process').execSync(name + ' ' + args.join(' ')).toString(); |
|
Jakob Kummerow
2015/06/19 09:43:53
80-col
noordhuis
2015/06/19 10:43:07
I suggest using `execFileSync(name, args, { encodi
mattloring
2015/06/19 17:29:03
Done.
mattloring
2015/06/19 17:29:03
Done.
|
| + } |
| +}; |
| + |
| +var print = print || console.log.bind(console); |
| + |
| +var read = read || function(fileName) { |
| + return require('fs').readFileSync(fileName, 'utf8'); |
| +}; |
| + |
| +// End Node polyfill |
| function inherits(childCtor, parentCtor) { |
| childCtor.prototype.__proto__ = parentCtor.prototype; |
| }; |
| - |
|
Jakob Kummerow
2015/06/19 09:43:53
keep this line
mattloring
2015/06/19 17:29:03
Done.
|
| function V8Profile(separateIc) { |
| Profile.call(this); |
| if (!separateIc) { |
| @@ -303,10 +324,8 @@ TickProcessor.prototype.isJsCode = function(name) { |
| TickProcessor.prototype.processLogFile = function(fileName) { |
| this.lastLogFileName_ = fileName; |
| - var line; |
| - while (line = readline()) { |
| - this.processLogLine(line); |
| - } |
| + var contents = readFile(fileName); |
| + this.processLogChunk(contents); |
|
Jakob Kummerow
2015/06/19 09:43:53
Nope, this is not equivalent. processLogLine has e
mattloring
2015/06/19 17:29:03
Done.
|
| }; |
| @@ -968,3 +987,13 @@ ArgumentsProcessor.prototype.printUsageAndExit = function() { |
| } |
| quit(2); |
| }; |
| + |
| +// Node exports |
| +if (typeof module !== 'undefined' && module.exports) { |
| + module.exports.UnixCppEntriesProvider = UnixCppEntriesProvider; |
| + module.exports.WindowsCppEntriesProvider = WindowsCppEntriesProvider; |
| + module.exports.MacCppEntriesProvider = MacCppEntriesProvider; |
| + module.exports.ArgumentsProcessor = ArgumentsProcessor; |
| + module.exports.TickProcessor = TickProcessor; |
| + module.exports.SnapshotLogProcessor = SnapshotLogProcessor; |
| +} |