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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console_model/ConsoleModel.js

Issue 2752403002: [DevTools] Migrate usages of Target to RuntimeModel where makes sense (Closed)
Patch Set: compilation errors Created 3 years, 9 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 /* 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 this.addMessage(consoleMessage); 200 this.addMessage(consoleMessage);
201 } 201 }
202 202
203 /** 203 /**
204 * @param {!SDK.RuntimeModel} runtimeModel 204 * @param {!SDK.RuntimeModel} runtimeModel
205 * @param {!Common.Event} event 205 * @param {!Common.Event} event
206 */ 206 */
207 _exceptionThrown(runtimeModel, event) { 207 _exceptionThrown(runtimeModel, event) {
208 var exceptionWithTimestamp = /** @type {!SDK.RuntimeModel.ExceptionWithTimes tamp} */ (event.data); 208 var exceptionWithTimestamp = /** @type {!SDK.RuntimeModel.ExceptionWithTimes tamp} */ (event.data);
209 var consoleMessage = ConsoleModel.ConsoleMessage.fromException( 209 var consoleMessage = ConsoleModel.ConsoleMessage.fromException(
210 runtimeModel.target(), exceptionWithTimestamp.details, undefined, except ionWithTimestamp.timestamp, undefined); 210 runtimeModel, exceptionWithTimestamp.details, undefined, exceptionWithTi mestamp.timestamp, undefined);
211 consoleMessage.setExceptionId(exceptionWithTimestamp.details.exceptionId); 211 consoleMessage.setExceptionId(exceptionWithTimestamp.details.exceptionId);
212 this.addMessage(consoleMessage); 212 this.addMessage(consoleMessage);
213 } 213 }
214 214
215 /** 215 /**
216 * @param {!SDK.RuntimeModel} runtimeModel 216 * @param {!SDK.RuntimeModel} runtimeModel
217 * @param {!Common.Event} event 217 * @param {!Common.Event} event
218 */ 218 */
219 _exceptionRevoked(runtimeModel, event) { 219 _exceptionRevoked(runtimeModel, event) {
220 var exceptionId = /** @type {number} */ (event.data); 220 var exceptionId = /** @type {number} */ (event.data);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 /** 454 /**
455 * @param {!ConsoleModel.ConsoleMessage} a 455 * @param {!ConsoleModel.ConsoleMessage} a
456 * @param {!ConsoleModel.ConsoleMessage} b 456 * @param {!ConsoleModel.ConsoleMessage} b
457 * @return {number} 457 * @return {number}
458 */ 458 */
459 static timestampComparator(a, b) { 459 static timestampComparator(a, b) {
460 return a.timestamp - b.timestamp; 460 return a.timestamp - b.timestamp;
461 } 461 }
462 462
463 /** 463 /**
464 * @param {!SDK.Target} target 464 * @param {!SDK.RuntimeModel} runtimeModel
caseq 2017/03/17 18:30:43 Meeh :( Perhaps keep target here?
dgozman 2017/03/17 21:43:46 Since exception comes from a runtime, passing Runt
465 * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails 465 * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails
466 * @param {string=} messageType 466 * @param {string=} messageType
467 * @param {number=} timestamp 467 * @param {number=} timestamp
468 * @param {string=} forceUrl 468 * @param {string=} forceUrl
469 * @return {!ConsoleModel.ConsoleMessage} 469 * @return {!ConsoleModel.ConsoleMessage}
470 */ 470 */
471 static fromException(target, exceptionDetails, messageType, timestamp, forceUr l) { 471 static fromException(runtimeModel, exceptionDetails, messageType, timestamp, f orceUrl) {
472 return new ConsoleModel.ConsoleMessage( 472 return new ConsoleModel.ConsoleMessage(
473 target, ConsoleModel.ConsoleMessage.MessageSource.JS, ConsoleModel.Conso leMessage.MessageLevel.Error, 473 runtimeModel.target(), ConsoleModel.ConsoleMessage.MessageSource.JS,
474 SDK.RuntimeModel.simpleTextFromException(exceptionDetails), messageType, forceUrl || exceptionDetails.url, 474 ConsoleModel.ConsoleMessage.MessageLevel.Error, SDK.RuntimeModel.simpleT extFromException(exceptionDetails),
475 exceptionDetails.lineNumber, exceptionDetails.columnNumber, undefined, 475 messageType, forceUrl || exceptionDetails.url, exceptionDetails.lineNumb er, exceptionDetails.columnNumber,
476 undefined,
476 exceptionDetails.exception ? 477 exceptionDetails.exception ?
477 [SDK.RemoteObject.fromLocalObject(exceptionDetails.text), exceptionD etails.exception] : 478 [SDK.RemoteObject.fromLocalObject(exceptionDetails.text), exceptionD etails.exception] :
478 undefined, 479 undefined,
479 exceptionDetails.stackTrace, timestamp, exceptionDetails.executionContex tId, exceptionDetails.scriptId); 480 exceptionDetails.stackTrace, timestamp, exceptionDetails.executionContex tId, exceptionDetails.scriptId);
480 } 481 }
481 482
482 /** 483 /**
483 * @return {?SDK.Target} 484 * @return {?SDK.Target}
484 */ 485 */
485 target() { 486 target() {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return 2; 666 return 2;
666 return 3; 667 return 3;
667 }; 668 };
668 669
669 ConsoleModel.ConsoleModel._events = Symbol('ConsoleModel.ConsoleModel.events'); 670 ConsoleModel.ConsoleModel._events = Symbol('ConsoleModel.ConsoleModel.events');
670 671
671 /** 672 /**
672 * @type {!ConsoleModel.ConsoleModel} 673 * @type {!ConsoleModel.ConsoleModel}
673 */ 674 */
674 ConsoleModel.consoleModel; 675 ConsoleModel.consoleModel;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698