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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/DefaultMapping.js

Issue 2418813005: DevTools: [Persistence] implement automapping (Closed)
Patch Set: address comments Created 4 years, 1 month 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!WebInspector.Workspace} workspace 7 * @param {!WebInspector.Workspace} workspace
8 * @param {!WebInspector.FileSystemMapping} fileSystemMapping 8 * @param {!WebInspector.FileSystemMapping} fileSystemMapping
9 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated 9 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated
10 * @param {function(!WebInspector.PersistenceBinding)} onBindingRemoved 10 * @param {function(!WebInspector.PersistenceBinding)} onBindingRemoved
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /** 73 /**
74 * @param {!WebInspector.UISourceCode} uiSourceCode 74 * @param {!WebInspector.UISourceCode} uiSourceCode
75 * @return {?WebInspector.PersistenceBinding} 75 * @return {?WebInspector.PersistenceBinding}
76 */ 76 */
77 _createBinding: function(uiSourceCode) 77 _createBinding: function(uiSourceCode)
78 { 78 {
79 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em) { 79 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em) {
80 var fileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSys temPath(uiSourceCode.project().id()); 80 var fileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSys temPath(uiSourceCode.project().id());
81 var networkURL = this._fileSystemMapping.networkURLForFileSystemURL( fileSystemPath, uiSourceCode.url()); 81 var networkURL = this._fileSystemMapping.networkURLForFileSystemURL( fileSystemPath, uiSourceCode.url());
82 var networkSourceCode = networkURL ? this._workspace.uiSourceCodeFor URL(networkURL) : null; 82 var networkSourceCode = networkURL ? this._workspace.uiSourceCodeFor URL(networkURL) : null;
83 return networkSourceCode ? new WebInspector.PersistenceBinding(netwo rkSourceCode, uiSourceCode) : null; 83 return networkSourceCode ? new WebInspector.PersistenceBinding(netwo rkSourceCode, uiSourceCode, false) : null;
84 } 84 }
85 if (uiSourceCode.project().type() === WebInspector.projectTypes.Network) { 85 if (uiSourceCode.project().type() === WebInspector.projectTypes.Network) {
86 var file = this._fileSystemMapping.fileForURL(uiSourceCode.url()); 86 var file = this._fileSystemMapping.fileForURL(uiSourceCode.url());
87 var projectId = file ? WebInspector.FileSystemWorkspaceBinding.proje ctId(file.fileSystemPath) : null; 87 var projectId = file ? WebInspector.FileSystemWorkspaceBinding.proje ctId(file.fileSystemPath) : null;
88 var fileSourceCode = file && projectId ? this._workspace.uiSourceCod e(projectId, file.fileURL) : null; 88 var fileSourceCode = file && projectId ? this._workspace.uiSourceCod e(projectId, file.fileURL) : null;
89 return fileSourceCode ? new WebInspector.PersistenceBinding(uiSource Code, fileSourceCode) : null; 89 return fileSourceCode ? new WebInspector.PersistenceBinding(uiSource Code, fileSourceCode, false) : null;
90 } 90 }
91 return null; 91 return null;
92 }, 92 },
93 93
94 /** 94 /**
95 * @param {!WebInspector.UISourceCode} uiSourceCode 95 * @param {!WebInspector.UISourceCode} uiSourceCode
96 */ 96 */
97 _bind: function(uiSourceCode) 97 _bind: function(uiSourceCode)
98 { 98 {
99 console.assert(!uiSourceCode[WebInspector.DefaultMapping._binding], "Can not bind already bound UISourceCode!"); 99 console.assert(!uiSourceCode[WebInspector.DefaultMapping._binding], "Can not bind already bound UISourceCode!");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 var binding = uiSourceCode[WebInspector.DefaultMapping._binding]; 135 var binding = uiSourceCode[WebInspector.DefaultMapping._binding];
136 this._unbind(binding.network); 136 this._unbind(binding.network);
137 this._bind(binding.network); 137 this._bind(binding.network);
138 }, 138 },
139 139
140 dispose: function() 140 dispose: function()
141 { 141 {
142 WebInspector.EventTarget.removeEventListeners(this._eventListeners); 142 WebInspector.EventTarget.removeEventListeners(this._eventListeners);
143 } 143 }
144 }; 144 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698