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

Side by Side Diff: Source/devtools/front_end/sdk/DefaultScriptMapping.js

Issue 299443016: DevTools: Decouple debugger model from UI entities (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge DebuggerScriptMapping into DebuggerWorkspaceBinding Created 6 years, 4 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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {WebInspector.ScriptSourceMapping} 33 * @implements {WebInspector.ScriptSourceMapping}
34 * @param {!WebInspector.DebuggerModel} debuggerModel 34 * @param {!WebInspector.DebuggerModel} debuggerModel
35 * @param {!WebInspector.Workspace} workspace 35 * @param {!WebInspector.Workspace} workspace
36 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
36 */ 37 */
37 WebInspector.DefaultScriptMapping = function(debuggerModel, workspace) 38 WebInspector.DefaultScriptMapping = function(debuggerModel, workspace, debuggerW orkspaceBinding)
38 { 39 {
39 this._debuggerModel = debuggerModel; 40 this._debuggerModel = debuggerModel;
41 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding;
40 this._workspace = workspace; 42 this._workspace = workspace;
41 this._projectId = WebInspector.DefaultScriptMapping.projectIdForTarget(debug gerModel.target()); 43 this._projectId = WebInspector.DefaultScriptMapping.projectIdForTarget(debug gerModel.target());
42 this._projectDelegate = new WebInspector.DebuggerProjectDelegate(this._works pace, this._projectId, WebInspector.projectTypes.Debugger); 44 this._projectDelegate = new WebInspector.DebuggerProjectDelegate(this._works pace, this._projectId, WebInspector.projectTypes.Debugger);
43 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, this._debuggerReset, this); 45 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, this._debuggerReset, this);
44 this._debuggerReset(); 46 this._debuggerReset();
45 } 47 }
46 48
47 WebInspector.DefaultScriptMapping.prototype = { 49 WebInspector.DefaultScriptMapping.prototype = {
48 /** 50 /**
49 * @param {!WebInspector.RawLocation} rawLocation 51 * @param {!WebInspector.RawLocation} rawLocation
(...skipping 29 matching lines...) Expand all
79 { 81 {
80 var path = this._projectDelegate.addScript(script); 82 var path = this._projectDelegate.addScript(script);
81 var uiSourceCode = this._workspace.uiSourceCode(this._projectId, path); 83 var uiSourceCode = this._workspace.uiSourceCode(this._projectId, path);
82 if (!uiSourceCode) { 84 if (!uiSourceCode) {
83 console.assert(uiSourceCode); 85 console.assert(uiSourceCode);
84 return; 86 return;
85 } 87 }
86 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode; 88 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode;
87 this._scriptIdForUISourceCode.put(uiSourceCode, script.scriptId); 89 this._scriptIdForUISourceCode.put(uiSourceCode, script.scriptId);
88 uiSourceCode.setSourceMappingForTarget(this._debuggerModel.target(), thi s); 90 uiSourceCode.setSourceMappingForTarget(this._debuggerModel.target(), thi s);
89 script.pushSourceMapping(this); 91 this._debuggerWorkspaceBinding.pushSourceMapping(script, this);
90 script.addEventListener(WebInspector.Script.Events.ScriptEdited, this._s criptEdited.bind(this, script.scriptId)); 92 script.addEventListener(WebInspector.Script.Events.ScriptEdited, this._s criptEdited.bind(this, script.scriptId));
91 }, 93 },
92 94
93 /** 95 /**
94 * @return {boolean} 96 * @return {boolean}
95 */ 97 */
96 isIdentity: function() 98 isIdentity: function()
97 { 99 {
98 return true; 100 return true;
99 }, 101 },
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 { 172 {
171 var contentProvider = script.isInlineScript() ? new WebInspector.Concate natedScriptsContentProvider([script]) : script; 173 var contentProvider = script.isInlineScript() ? new WebInspector.Concate natedScriptsContentProvider([script]) : script;
172 var splitURL = WebInspector.ParsedURL.splitURL(script.sourceURL); 174 var splitURL = WebInspector.ParsedURL.splitURL(script.sourceURL);
173 var name = splitURL[splitURL.length - 1]; 175 var name = splitURL[splitURL.length - 1];
174 name = "VM" + script.scriptId + (name ? " " + name : ""); 176 name = "VM" + script.scriptId + (name ? " " + name : "");
175 return this.addContentProvider("", name, script.sourceURL, contentProvid er); 177 return this.addContentProvider("", name, script.sourceURL, contentProvid er);
176 }, 178 },
177 179
178 __proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype 180 __proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype
179 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698