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

Unified Diff: third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js

Issue 2931773002: DevTools: kill DebuggerWorkspaceBinding.{push,pop,set}SourceMapping (Closed)
Patch Set: address comments Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js b/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
index 585fb32650fa15f7a659fd01f1febcfa93105c2a..4440a176d20b7f915aef8117c249e0be3471440e 100644
--- a/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
@@ -30,6 +30,7 @@
/**
* @unrestricted
* @implements {SDK.SDKModelObserver<!SDK.DebuggerModel>}
+ * @implements {Bindings.DebuggerSourceMapping}
*/
Snippets.ScriptSnippetModel = class extends Common.Object {
/**
@@ -50,6 +51,7 @@ Snippets.ScriptSnippetModel = class extends Common.Object {
this._project = new Snippets.SnippetsProject(workspace, this);
this._loadSnippets();
SDK.targetManager.observeModels(SDK.DebuggerModel, this);
+ Bindings.debuggerWorkspaceBinding.addSourceMapping(this);
}
/**
@@ -68,6 +70,34 @@ Snippets.ScriptSnippetModel = class extends Common.Object {
this._mappingForDebuggerModel.remove(debuggerModel);
}
+ /**
+ * @override
+ * @param {!SDK.DebuggerModel.Location} rawLocation
+ * @return {?Workspace.UILocation}
+ */
+ rawLocationToUILocation(rawLocation) {
+ var mapping = this._mappingForDebuggerModel.get(rawLocation.debuggerModel);
+ if (!mapping)
+ return null;
+ return mapping.rawLocationToUILocation(rawLocation);
+ }
+
+ /**
+ * @override
+ * @param {!Workspace.UISourceCode} uiSourceCode
+ * @param {number} lineNumber
+ * @param {number} columnNumber
+ * @return {?SDK.DebuggerModel.Location}
+ */
+ uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {
+ for (var mapping of this._mappingForDebuggerModel.values()) {
+ var rawLocation = mapping.uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber);
+ if (rawLocation)
+ return rawLocation;
+ }
+ return null;
+ }
+
/**
* @param {!SDK.DebuggerModel} debuggerModel
* @return {!Snippets.SnippetScriptMapping|undefined}
@@ -337,7 +367,6 @@ Snippets.ScriptSnippetModel = class extends Common.Object {
Snippets.ScriptSnippetModel.snippetSourceURLPrefix = 'snippets:///';
/**
- * @implements {Bindings.DebuggerSourceMapping}
* @unrestricted
*/
Snippets.SnippetScriptMapping = class {
@@ -403,7 +432,6 @@ Snippets.SnippetScriptMapping = class {
}
/**
- * @override
* @param {!SDK.DebuggerModel.Location} rawLocation
* @return {?Workspace.UILocation}
*/
@@ -417,7 +445,6 @@ Snippets.SnippetScriptMapping = class {
}
/**
- * @override
* @param {!Workspace.UISourceCode} uiSourceCode
* @param {number} lineNumber
* @param {number} columnNumber
@@ -437,10 +464,9 @@ Snippets.SnippetScriptMapping = class {
*/
_addScript(script, uiSourceCode) {
console.assert(!this._scriptForUISourceCode.get(uiSourceCode));
- Bindings.debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSourceCode, this);
this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode;
this._scriptForUISourceCode.set(uiSourceCode, script);
- Bindings.debuggerWorkspaceBinding.pushSourceMapping(script, this);
+ Bindings.debuggerWorkspaceBinding.updateLocations(script);
}
/**
@@ -457,24 +483,6 @@ Snippets.SnippetScriptMapping = class {
if (scriptUISourceCode)
this._scriptSnippetModel._restoreBreakpoints(scriptUISourceCode, breakpointLocations);
}
-
- /**
- * @override
- * @return {boolean}
- */
- isIdentity() {
- return false;
- }
-
- /**
- * @override
- * @param {!Workspace.UISourceCode} uiSourceCode
- * @param {number} lineNumber
- * @return {boolean}
- */
- uiLineHasMapping(uiSourceCode, lineNumber) {
- return true;
- }
};
/**

Powered by Google App Engine
This is Rietveld 408576698