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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineModelImpl.js

Issue 396993003: DevTools: get rid of WebInspector.cssModel, use target models instead (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 * @constructor 6 * @constructor
7 * @extends {WebInspector.TimelineModel} 7 * @extends {WebInspector.TimelineModel}
8 * @param {!WebInspector.TimelineManager} timelineManager 8 * @param {!WebInspector.TimelineManager} timelineManager
9 */ 9 */
10 WebInspector.TimelineModelImpl = function(timelineManager) 10 WebInspector.TimelineModelImpl = function(timelineManager)
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 return; 558 return;
559 559
560 // Prepending "0" to turn string into valid JSON. 560 // Prepending "0" to turn string into valid JSON.
561 if (!this._firstChunk) 561 if (!this._firstChunk)
562 json = "[0" + json; 562 json = "[0" + json;
563 563
564 var items; 564 var items;
565 try { 565 try {
566 items = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ (JSON.p arse(json)); 566 items = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ (JSON.p arse(json));
567 } catch (e) { 567 } catch (e) {
568 WebInspector.console.addErrorMessage("Malformed timeline data.", tru e); 568 WebInspector.console.error("Malformed timeline data.");
569 this._model.reset(); 569 this._model.reset();
570 this._reader.cancel(); 570 this._reader.cancel();
571 this._progress.done(); 571 this._progress.done();
572 return; 572 return;
573 } 573 }
574 574
575 if (this._firstChunk) { 575 if (this._firstChunk) {
576 this._version = items[0]; 576 this._version = items[0];
577 this._firstChunk = false; 577 this._firstChunk = false;
578 this._model.reset(); 578 this._model.reset();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 /** 634 /**
635 * @param {!WebInspector.ChunkedReader} reader 635 * @param {!WebInspector.ChunkedReader} reader
636 * @param {!Event} event 636 * @param {!Event} event
637 */ 637 */
638 onError: function(reader, event) 638 onError: function(reader, event)
639 { 639 {
640 this._progress.done(); 640 this._progress.done();
641 this._model.reset(); 641 this._model.reset();
642 switch (event.target.error.code) { 642 switch (event.target.error.code) {
643 case FileError.NOT_FOUND_ERR: 643 case FileError.NOT_FOUND_ERR:
644 WebInspector.console.addErrorMessage(WebInspector.UIString("File \"% s\" not found.", reader.fileName()), true); 644 WebInspector.console.error(WebInspector.UIString("File \"%s\" not fo und.", reader.fileName()));
645 break; 645 break;
646 case FileError.NOT_READABLE_ERR: 646 case FileError.NOT_READABLE_ERR:
647 WebInspector.console.addErrorMessage(WebInspector.UIString("File \"% s\" is not readable", reader.fileName()), true); 647 WebInspector.console.error(WebInspector.UIString("File \"%s\" is not readable", reader.fileName()));
648 break; 648 break;
649 case FileError.ABORT_ERR: 649 case FileError.ABORT_ERR:
650 break; 650 break;
651 default: 651 default:
652 WebInspector.console.addErrorMessage(WebInspector.UIString("An error occurred while reading the file \"%s\"", reader.fileName()), true); 652 WebInspector.console.error(WebInspector.UIString("An error occurred while reading the file \"%s\"", reader.fileName()));
653 } 653 }
654 } 654 }
655 } 655 }
656 656
657 /** 657 /**
658 * @constructor 658 * @constructor
659 * @param {!WebInspector.OutputStream} stream 659 * @param {!WebInspector.OutputStream} stream
660 */ 660 */
661 WebInspector.TimelineSaver = function(stream) 661 WebInspector.TimelineSaver = function(stream)
662 { 662 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 break; 701 break;
702 length += itemLength; 702 length += itemLength;
703 data.push(item); 703 data.push(item);
704 ++this._recordIndex; 704 ++this._recordIndex;
705 } 705 }
706 if (this._recordIndex === this._payloads.length) 706 if (this._recordIndex === this._payloads.length)
707 data.push(data.pop() + "]"); 707 data.push(data.pop() + "]");
708 stream.write(data.join(separator), this._writeNextChunk.bind(this)); 708 stream.write(data.join(separator), this._writeNextChunk.bind(this));
709 } 709 }
710 } 710 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698