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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js

Issue 2514323008: DevTools: move message management from UISourceCodeFrame to UISourceCode (Closed)
Patch Set: address comments Created 4 years 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 | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 this._workingCopy = this._workingCopyGetter(); 432 this._workingCopy = this._workingCopyGetter();
433 delete this._workingCopyGetter; 433 delete this._workingCopyGetter;
434 } 434 }
435 if (this.isDirty()) 435 if (this.isDirty())
436 return this._workingCopy; 436 return this._workingCopy;
437 return this._content; 437 return this._content;
438 } 438 }
439 439
440 resetWorkingCopy() { 440 resetWorkingCopy() {
441 this._innerResetWorkingCopy(); 441 this._innerResetWorkingCopy();
442 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed); 442 this._workingCopyChanged();
443 } 443 }
444 444
445 _innerResetWorkingCopy() { 445 _innerResetWorkingCopy() {
446 delete this._workingCopy; 446 delete this._workingCopy;
447 delete this._workingCopyGetter; 447 delete this._workingCopyGetter;
448 } 448 }
449 449
450 /** 450 /**
451 * @param {string} newWorkingCopy 451 * @param {string} newWorkingCopy
452 */ 452 */
453 setWorkingCopy(newWorkingCopy) { 453 setWorkingCopy(newWorkingCopy) {
454 this._workingCopy = newWorkingCopy; 454 this._workingCopy = newWorkingCopy;
455 delete this._workingCopyGetter; 455 delete this._workingCopyGetter;
456 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed); 456 this._workingCopyChanged();
457 this._project.workspace().dispatchEventToListeners(
458 Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this});
459 } 457 }
460 458
461 setWorkingCopyGetter(workingCopyGetter) { 459 setWorkingCopyGetter(workingCopyGetter) {
462 this._workingCopyGetter = workingCopyGetter; 460 this._workingCopyGetter = workingCopyGetter;
461 this._workingCopyChanged();
462 }
463
464 _workingCopyChanged() {
465 this._removeAllMessages();
463 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed); 466 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed);
464 this._project.workspace().dispatchEventToListeners( 467 this._project.workspace().dispatchEventToListeners(
465 Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this}); 468 Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this});
466 } 469 }
467 470
468 removeWorkingCopyGetter() { 471 removeWorkingCopyGetter() {
469 if (!this._workingCopyGetter) 472 if (!this._workingCopyGetter)
470 return; 473 return;
471 this._workingCopy = this._workingCopyGetter(); 474 this._workingCopy = this._workingCopyGetter();
472 delete this._workingCopyGetter; 475 delete this._workingCopyGetter;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 } 591 }
589 592
590 /** 593 /**
591 * @param {!Workspace.UISourceCode.Message} message 594 * @param {!Workspace.UISourceCode.Message} message
592 */ 595 */
593 removeMessage(message) { 596 removeMessage(message) {
594 if (this._messages.remove(message)) 597 if (this._messages.remove(message))
595 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); 598 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message);
596 } 599 }
597 600
598 removeAllMessages() { 601 _removeAllMessages() {
599 var messages = this._messages; 602 var messages = this._messages;
600 this._messages = []; 603 this._messages = [];
601 for (var message of messages) 604 for (var message of messages)
602 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); 605 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message);
603 } 606 }
604 607
605 /** 608 /**
606 * @param {number} lineNumber 609 * @param {number} lineNumber
607 * @param {string} type 610 * @param {string} type
608 * @param {?} data 611 * @param {?} data
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 Workspace.UISourceCodeMetadata = class { 946 Workspace.UISourceCodeMetadata = class {
944 /** 947 /**
945 * @param {?Date} modificationTime 948 * @param {?Date} modificationTime
946 * @param {?number} contentSize 949 * @param {?number} contentSize
947 */ 950 */
948 constructor(modificationTime, contentSize) { 951 constructor(modificationTime, contentSize) {
949 this.modificationTime = modificationTime; 952 this.modificationTime = modificationTime;
950 this.contentSize = contentSize; 953 this.contentSize = contentSize;
951 } 954 }
952 }; 955 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698