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

Side by Side Diff: Source/devtools/front_end/sdk/PresentationConsoleMessageHelper.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 /* 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 25 matching lines...) Expand all
36 WebInspector.PresentationConsoleMessageHelper = function(workspace) 36 WebInspector.PresentationConsoleMessageHelper = function(workspace)
37 { 37 {
38 /** 38 /**
39 * @type {!Object.<string, !Array.<!WebInspector.ConsoleMessage>>} 39 * @type {!Object.<string, !Array.<!WebInspector.ConsoleMessage>>}
40 */ 40 */
41 this._pendingConsoleMessages = {}; 41 this._pendingConsoleMessages = {};
42 this._presentationConsoleMessages = []; 42 this._presentationConsoleMessages = [];
43 this._workspace = workspace; 43 this._workspace = workspace;
44 44
45 WebInspector.targetManager.observeTargets(this); 45 WebInspector.targetManager.observeTargets(this);
46 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.ConsoleCleared, this._consoleCleared, this);
47 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, this._onConsoleMessageAdded, this);
48 WebInspector.multitargetConsoleModel.messages().forEach(this._consoleMessage Added, this);
46 } 49 }
47 50
48 WebInspector.PresentationConsoleMessageHelper.prototype = { 51 WebInspector.PresentationConsoleMessageHelper.prototype = {
49 /** 52 /**
50 * @param {!WebInspector.Target} target 53 * @param {!WebInspector.Target} target
51 */ 54 */
52 targetAdded: function(target) 55 targetAdded: function(target)
53 { 56 {
54 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me ssageAdded, this._consoleMessageAdded, this);
55 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co nsoleCleared, this._consoleCleared, this);
56
57 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. ParsedScriptSource, this._parsedScriptSource, this); 57 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. ParsedScriptSource, this._parsedScriptSource, this);
58 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. FailedToParseScriptSource, this._parsedScriptSource, this); 58 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. FailedToParseScriptSource, this._parsedScriptSource, this);
59 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. GlobalObjectCleared, this._debuggerReset, this); 59 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. GlobalObjectCleared, this._debuggerReset, this);
60 }, 60 },
61 61
62 /** 62 /**
63 * @param {!WebInspector.Target} target 63 * @param {!WebInspector.Target} target
64 */ 64 */
65 targetRemoved: function(target) 65 targetRemoved: function(target)
66 { 66 {
67 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events .MessageAdded, this._consoleMessageAdded, this);
68 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events .ConsoleCleared, this._consoleCleared, this);
69
70 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.ParsedScriptSource, this._parsedScriptSource, this); 67 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.ParsedScriptSource, this._parsedScriptSource, this);
71 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.FailedToParseScriptSource, this._parsedScriptSource, this); 68 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.FailedToParseScriptSource, this._parsedScriptSource, this);
72 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.GlobalObjectCleared, this._debuggerReset, this); 69 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.GlobalObjectCleared, this._debuggerReset, this);
73 }, 70 },
74 71
75 /** 72 /**
76 * @param {!WebInspector.Event} event 73 * @param {!WebInspector.Event} event
77 */ 74 */
78 _consoleMessageAdded: function(event) 75 _onConsoleMessageAdded: function(event)
79 { 76 {
80 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data); 77 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data);
78 this._consoleMessageAdded(message)
79 },
80
81 /**
82 * @param {!WebInspector.ConsoleMessage} message
83 */
84 _consoleMessageAdded: function(message)
85 {
81 if (!message.url || !message.isErrorOrWarning()) 86 if (!message.url || !message.isErrorOrWarning())
82 return; 87 return;
83 88
84 var rawLocation = this._rawLocation(message); 89 var rawLocation = this._rawLocation(message);
85 if (rawLocation) 90 if (rawLocation)
86 this._addConsoleMessageToScript(message, rawLocation); 91 this._addConsoleMessageToScript(message, rawLocation);
87 else 92 else
88 this._addPendingConsoleMessage(message); 93 this._addPendingConsoleMessage(message);
89 }, 94 },
90 95
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 get lineNumber() 197 get lineNumber()
193 { 198 {
194 return this._uiLocation.lineNumber; 199 return this._uiLocation.lineNumber;
195 }, 200 },
196 201
197 dispose: function() 202 dispose: function()
198 { 203 {
199 this._liveLocation.dispose(); 204 this._liveLocation.dispose();
200 } 205 }
201 } 206 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/LiveEditSupport.js ('k') | Source/devtools/front_end/sdk/SASSSourceMapping.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698