Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js |
| index a1ce9bf75696b44b07321de24613ec4ab9fc62e0..9516db23e8f4b5db4e9575ec3aed4b64beb3c4d9 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js |
| @@ -243,16 +243,23 @@ Sources.NavigatorView = class extends UI.VBox { |
| /** |
| * @param {!Workspace.UISourceCode} uiSourceCode |
| - * @return {?SDK.ResourceTreeFrame} |
| + * @return {?Array<!SDK.ResourceTreeFrame>} |
| */ |
| - _uiSourceCodeFrame(uiSourceCode) { |
| - var frame = Bindings.NetworkProject.frameForProject(uiSourceCode.project()); |
| - if (!frame) { |
| - var target = Bindings.NetworkProject.targetForProject(uiSourceCode.project()); |
| - var resourceTreeModel = target && target.model(SDK.ResourceTreeModel); |
| - frame = resourceTreeModel && resourceTreeModel.mainFrame; |
| + _uiSourceCodeFrames(uiSourceCode) { |
| + var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode); |
| + var resourceTreeModel = target && target.model(SDK.ResourceTreeModel); |
| + if (!resourceTreeModel) |
| + return null; |
| + var frames = null; |
| + var frameIds = Bindings.NetworkProject.frameAttribution(uiSourceCode); |
| + if (frameIds && frameIds.size) { |
| + frames = Array.from(frameIds).map(frameId => resourceTreeModel.frameForId(frameId)); |
|
dgozman
2017/04/20 17:12:07
Let's make NetworkProject do the mapping and retur
lushnikov
2017/04/21 01:21:51
Done.
|
| + } else { |
| + // This is to overcome compilation cache which doesn't get reset. |
| + frames = [resourceTreeModel.mainFrame]; |
| } |
| - return frame; |
| + frames = frames.filter(frame => !!frame); |
| + return frames.length ? frames : null; |
| } |
| /** |
| @@ -275,13 +282,24 @@ Sources.NavigatorView = class extends UI.VBox { |
| var project = uiSourceCode.project(); |
| var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode); |
| - var frame = this._uiSourceCodeFrame(uiSourceCode); |
| - |
| - var folderNode = |
| - this._folderNode(uiSourceCode, project, target, frame, uiSourceCode.origin(), path, isFromSourceMap); |
| - var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSourceCode); |
| - this._uiSourceCodeNodes.set(uiSourceCode, [uiSourceCodeNode]); |
| - folderNode.appendChild(uiSourceCodeNode); |
| + var frames = this._uiSourceCodeFrames(uiSourceCode); |
| + var uiSourceCodeNodes = []; |
| + if (frames && frames.length) { |
|
dgozman
2017/04/20 17:12:07
frames are never empty.
lushnikov
2017/04/21 01:21:51
Done.
|
| + for (var frame of frames) { |
| + var folderNode = |
| + this._folderNode(uiSourceCode, project, target, frame, uiSourceCode.origin(), path, isFromSourceMap); |
| + var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSourceCode, frame); |
| + folderNode.appendChild(uiSourceCodeNode); |
| + uiSourceCodeNodes.push(uiSourceCodeNode); |
| + } |
| + } else { |
| + var folderNode = |
| + this._folderNode(uiSourceCode, project, target, null, uiSourceCode.origin(), path, isFromSourceMap); |
| + var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSourceCode, null); |
| + folderNode.appendChild(uiSourceCodeNode); |
| + uiSourceCodeNodes.push(uiSourceCodeNode); |
| + } |
| + this._uiSourceCodeNodes.set(uiSourceCode, uiSourceCodeNodes); |
| this.uiSourceCodeAdded(uiSourceCode); |
| } |
| @@ -530,7 +548,7 @@ Sources.NavigatorView = class extends UI.VBox { |
| var project = uiSourceCode.project(); |
| var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode); |
| - var frame = this._uiSourceCodeFrame(uiSourceCode); |
| + var frame = node.frame(); |
| var parentNode = node.parent; |
| parentNode.removeChild(node); |
| @@ -1214,13 +1232,22 @@ Sources.NavigatorUISourceCodeTreeNode = class extends Sources.NavigatorTreeNode |
| /** |
| * @param {!Sources.NavigatorView} navigatorView |
| * @param {!Workspace.UISourceCode} uiSourceCode |
| + * @param {?SDK.ResourceTreeFrame} frame |
| */ |
| - constructor(navigatorView, uiSourceCode) { |
| + constructor(navigatorView, uiSourceCode, frame) { |
| super(uiSourceCode.project().id() + ':' + uiSourceCode.url(), Sources.NavigatorView.Types.File); |
| this._navigatorView = navigatorView; |
| this._uiSourceCode = uiSourceCode; |
| this._treeElement = null; |
| this._eventListeners = []; |
| + this._frame = frame; |
| + } |
| + |
| + /** |
| + * @return {?SDK.ResourceTreeFrame} |
| + */ |
| + frame() { |
| + return this._frame; |
| } |
| /** |