OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 accept: function(record) | 550 accept: function(record) |
551 { | 551 { |
552 return !!this._recordTypes[record.type()]; | 552 return !!this._recordTypes[record.type()]; |
553 }, | 553 }, |
554 | 554 |
555 __proto__: WebInspector.TimelineRecordTypeFilter.prototype | 555 __proto__: WebInspector.TimelineRecordTypeFilter.prototype |
556 } | 556 } |
557 | 557 |
558 /** | 558 /** |
559 * @constructor | 559 * @constructor |
560 */ | |
561 WebInspector.TimelineMergingRecordBuffer = function() | |
562 { | |
563 this._backgroundRecordsBuffer = []; | |
564 } | |
565 | |
566 /** | |
567 * @constructor | |
568 */ | |
569 WebInspector.TimelineMergingRecordBuffer.prototype = { | |
570 /** | |
571 * @param {string} thread | |
572 * @param {!Array.<!WebInspector.TimelineModel.Record>} records | |
573 * @return {!Array.<!WebInspector.TimelineModel.Record>} | |
574 */ | |
575 process: function(thread, records) | |
576 { | |
577 if (thread !== WebInspector.TimelineModel.MainThreadName) { | |
578 this._backgroundRecordsBuffer = this._backgroundRecordsBuffer.concat
(records); | |
579 return []; | |
580 } | |
581 /** | |
582 * @param {!WebInspector.TimelineModel.Record} a | |
583 * @param {!WebInspector.TimelineModel.Record} b | |
584 */ | |
585 function recordTimestampComparator(a, b) | |
586 { | |
587 // Never return 0, as the merge function will squash identical entri
es. | |
588 return a.startTime() < b.startTime() ? -1 : 1; | |
589 } | |
590 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT
imestampComparator); | |
591 this._backgroundRecordsBuffer = []; | |
592 return result; | |
593 } | |
594 } | |
595 | |
596 /** | |
597 * @constructor | |
598 * @implements {WebInspector.OutputStreamDelegate} | 560 * @implements {WebInspector.OutputStreamDelegate} |
599 * @param {!WebInspector.TimelineModel} model | 561 * @param {!WebInspector.TimelineModel} model |
600 * @param {!WebInspector.Progress} progress | 562 * @param {!WebInspector.Progress} progress |
601 */ | 563 */ |
602 WebInspector.TimelineModelLoadFromFileDelegate = function(model, progress) | 564 WebInspector.TimelineModelLoadFromFileDelegate = function(model, progress) |
603 { | 565 { |
604 this._model = model; | 566 this._model = model; |
605 this._progress = progress; | 567 this._progress = progress; |
606 } | 568 } |
607 | 569 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 case FileError.NOT_READABLE_ERR: | 612 case FileError.NOT_READABLE_ERR: |
651 WebInspector.console.error(WebInspector.UIString("File \"%s\" is not
readable", reader.fileName())); | 613 WebInspector.console.error(WebInspector.UIString("File \"%s\" is not
readable", reader.fileName())); |
652 break; | 614 break; |
653 case FileError.ABORT_ERR: | 615 case FileError.ABORT_ERR: |
654 break; | 616 break; |
655 default: | 617 default: |
656 WebInspector.console.error(WebInspector.UIString("An error occurred
while reading the file \"%s\"", reader.fileName())); | 618 WebInspector.console.error(WebInspector.UIString("An error occurred
while reading the file \"%s\"", reader.fileName())); |
657 } | 619 } |
658 } | 620 } |
659 } | 621 } |
OLD | NEW |