Changeset 142474 in webkit
- Timestamp:
- Feb 11, 2013 7:50:38 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142470 r142474 1 2013-02-11 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: WebInspector.Project refactorings. 4 https://bugs.webkit.org/show_bug.cgi?id=109433 5 6 Reviewed by Alexander Pavlov. 7 8 * inspector/debugger/live-edit-breakpoints.html: 9 * inspector/uisourcecode-revisions.html: 10 1 11 2013-02-11 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 12 -
trunk/LayoutTests/inspector/debugger/live-edit-breakpoints.html
r139859 r142474 41 41 var uiSourceCode = uiLocation.uiSourceCode; 42 42 var project = WebInspector.workspace.projectForUISourceCode(uiSourceCode); 43 InspectorTest.addResult(" url: " + pathToFileName(uiSourceCode.originURL()) + ", lineNumber: " + uiLocation.lineNumber + ", project name: " + project. name());43 InspectorTest.addResult(" url: " + pathToFileName(uiSourceCode.originURL()) + ", lineNumber: " + uiLocation.lineNumber + ", project name: " + project.id()); 44 44 } 45 45 } -
trunk/LayoutTests/inspector/uisourcecode-revisions.html
r142269 r142474 10 10 { 11 11 var workspace = new WebInspector.Workspace(); 12 var workspaceProvider = new WebInspector.SimpleWorkspaceProvider(workspace,WebInspector.projectTypes.Network);13 var project = workspace.addProject( WebInspector.projectTypes.Network, workspaceProvider);12 var projectDelegate = new WebInspector.SimpleProjectDelegate(WebInspector.projectTypes.Network); 13 var project = workspace.addProject(projectDelegate); 14 14 project.requestFileContent = function(uri, callback) 15 15 { -
trunk/Source/WebCore/ChangeLog
r142473 r142474 1 2013-02-11 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: WebInspector.Project refactorings. 4 https://bugs.webkit.org/show_bug.cgi?id=109433 5 6 Reviewed by Alexander Pavlov. 7 8 This change prepares Workspace and Project to migration to project-per-domain mode for network based projects. 9 Renamed WebInspector.WorkspaceProvider to WebInspector.ProjectDelegate. 10 Renamed Project.name() to Project.id() and delegated it to project delegate. 11 Added Project.displayName() method that is delegated to project delegate. 12 SimpleWorkspaceProvider is now responsible for creation of SimpleWorkspaceDelegates and 13 isolates various mappings from Project/ProjectDelegate concept. 14 UISourceCode is now created based on path in the project. 15 UISourceCode uri is now calculated based on project and path (right now uri is equal to path). 16 17 * WebCore.gypi: 18 * WebCore.vcproj/WebCore.vcproj: 19 * inspector/compile-front-end.py: 20 * inspector/front-end/FileSystemProjectDelegate.js: Renamed from Source/WebCore/inspector/front-end/FileSystemWorkspaceProvider.js. 21 (WebInspector.FileSystemProjectDelegate): 22 (WebInspector.FileSystemProjectDelegate.prototype.id): 23 (WebInspector.FileSystemProjectDelegate.prototype.type): 24 (WebInspector.FileSystemProjectDelegate.prototype.displayName): 25 (WebInspector.FileSystemProjectDelegate.prototype.innerCallback): 26 (WebInspector.FileSystemProjectDelegate.prototype.requestFileContent): 27 (WebInspector.FileSystemProjectDelegate.prototype.setFileContent): 28 (WebInspector.FileSystemProjectDelegate.prototype.contentCallback): 29 (WebInspector.FileSystemProjectDelegate.prototype.searchInFileContent): 30 (WebInspector.FileSystemProjectDelegate.prototype._contentTypeForPath): 31 (WebInspector.FileSystemProjectDelegate.prototype._populate.filesLoaded): 32 (WebInspector.FileSystemProjectDelegate.prototype._populate): 33 (WebInspector.FileSystemProjectDelegate.prototype._addFile): 34 (WebInspector.FileSystemProjectDelegate.prototype._removeFile): 35 (WebInspector.FileSystemProjectDelegate.prototype.reset): 36 (WebInspector.FileSystemUtils): 37 (WebInspector.FileSystemUtils.errorHandler): 38 (WebInspector.FileSystemUtils.requestFileSystem): 39 (.fileSystemLoaded): 40 (.innerCallback): 41 (WebInspector.FileSystemUtils.requestFilesRecursive): 42 (.fileEntryLoaded): 43 (.fileLoaded): 44 (.readerLoadEnd): 45 (WebInspector.FileSystemUtils.requestFileContent): 46 (.fileWriterCreated.fileTruncated): 47 (.fileWriterCreated): 48 (.writerEnd): 49 (WebInspector.FileSystemUtils.setFileContent): 50 (WebInspector.FileSystemUtils._getDirectory): 51 (.toArray): 52 (WebInspector.FileSystemUtils._readDirectory): 53 (WebInspector.FileSystemUtils._requestEntries): 54 * inspector/front-end/IsolatedFileSystemModel.js: 55 (WebInspector.IsolatedFileSystemModel.prototype._innerAddFileSystem): 56 * inspector/front-end/SimpleWorkspaceProvider.js: 57 (WebInspector.SimpleProjectDelegate): 58 (WebInspector.SimpleProjectDelegate.prototype.id): 59 (WebInspector.SimpleProjectDelegate.prototype.displayName): 60 (WebInspector.SimpleProjectDelegate.prototype.requestFileContent): 61 (WebInspector.SimpleProjectDelegate.prototype.setFileContent): 62 (WebInspector.SimpleProjectDelegate.prototype.searchInFileContent): 63 (WebInspector.SimpleProjectDelegate.prototype.addFile): 64 (WebInspector.SimpleProjectDelegate.prototype._uniquePath): 65 (WebInspector.SimpleProjectDelegate.prototype.removeFile): 66 (WebInspector.SimpleProjectDelegate.prototype.reset): 67 (WebInspector.SimpleWorkspaceProvider): 68 (WebInspector.SimpleWorkspaceProvider.uriForURL): 69 (WebInspector.SimpleWorkspaceProvider.prototype.addFileForURL): 70 (WebInspector.SimpleWorkspaceProvider.prototype.addUniqueFileForURL): 71 (WebInspector.SimpleWorkspaceProvider.prototype._innerAddFileForURL): 72 (WebInspector.SimpleWorkspaceProvider.prototype.removeFile): 73 (WebInspector.SimpleWorkspaceProvider.prototype.reset): 74 * inspector/front-end/UISourceCode.js: 75 (WebInspector.UISourceCode): 76 (WebInspector.UISourceCode.prototype.path): 77 (WebInspector.UISourceCode.prototype.uri): 78 * inspector/front-end/WebKit.qrc: 79 * inspector/front-end/Workspace.js: 80 (WebInspector.FileDescriptor): 81 (WebInspector.ProjectDelegate): 82 (WebInspector.ProjectDelegate.prototype.id): 83 (WebInspector.ProjectDelegate.prototype.displayName): 84 (WebInspector.ProjectDelegate.prototype.requestFileContent): 85 (WebInspector.ProjectDelegate.prototype.setFileContent): 86 (WebInspector.ProjectDelegate.prototype.searchInFileContent): 87 (WebInspector.Project): 88 (WebInspector.Project.prototype.id): 89 (WebInspector.Project.prototype.type): 90 (WebInspector.Project.prototype.displayName): 91 (WebInspector.Project.prototype.isServiceProject): 92 (WebInspector.Project.prototype._fileAdded): 93 (WebInspector.Project.prototype._fileRemoved): 94 (WebInspector.Project.prototype._reset): 95 (WebInspector.Project.prototype.uiSourceCode): 96 (WebInspector.Project.prototype.uiSourceCodeForOriginURL): 97 (WebInspector.Project.prototype.uiSourceCodeForURI): 98 (WebInspector.Project.prototype.uiSourceCodes): 99 (WebInspector.Project.prototype.requestFileContent): 100 (WebInspector.Project.prototype.setFileContent): 101 (WebInspector.Project.prototype.searchInFileContent): 102 (WebInspector.Project.prototype.dispose): 103 (WebInspector.Workspace.prototype.uiSourceCode): 104 (WebInspector.Workspace.prototype.uiSourceCodeForURI): 105 (WebInspector.Workspace.prototype.addProject): 106 (WebInspector.Workspace.prototype.removeProject): 107 (WebInspector.Workspace.prototype.project): 108 (WebInspector.Workspace.prototype.uiSourceCodes): 109 (WebInspector.Workspace.prototype.projectForUISourceCode): 110 * inspector/front-end/inspector.html: 111 1 112 2013-02-11 Yury Semikhatsky <yurys@chromium.org> 2 113 -
trunk/Source/WebCore/WebCore.gypi
r142471 r142474 5219 5219 'inspector/front-end/FileSystemMapping.js', 5220 5220 'inspector/front-end/FileSystemModel.js', 5221 'inspector/front-end/FileSystem WorkspaceProvider.js',5221 'inspector/front-end/FileSystemProjectDelegate.js', 5222 5222 'inspector/front-end/FileUtils.js', 5223 5223 'inspector/front-end/FontView.js', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r142471 r142474 77163 77163 </File> 77164 77164 <File 77165 RelativePath="..\inspector\front-end\FileSystem WorkspaceProvider.js"77165 RelativePath="..\inspector\front-end\FileSystemProjectDelegate.js" 77166 77166 > 77167 77167 </File> -
trunk/Source/WebCore/inspector/compile-front-end.py
r142471 r142474 80 80 "FileSystemMapping.js", 81 81 "FileSystemModel.js", 82 "FileSystem WorkspaceProvider.js",82 "FileSystemProjectDelegate.js", 83 83 "FileUtils.js", 84 84 "HAREntry.js", -
trunk/Source/WebCore/inspector/front-end/FileSystemProjectDelegate.js
r142473 r142474 31 31 /** 32 32 * @constructor 33 * @implements {WebInspector. WorkspaceProvider}33 * @implements {WebInspector.ProjectDelegate} 34 34 * @extends {WebInspector.Object} 35 35 * @param {WebInspector.IsolatedFileSystemModel} isolatedFileSystemModel 36 * @param {string} fileSystemId 36 37 * @param {string} fileSystemPath 37 38 */ 38 WebInspector.FileSystem WorkspaceProvider = function(isolatedFileSystemModel, fileSystemPath)39 WebInspector.FileSystemProjectDelegate = function(isolatedFileSystemModel, fileSystemId, fileSystemPath) 39 40 { 40 41 this._isolatedFileSystemModel = isolatedFileSystemModel; 42 this._fileSystemId = fileSystemId; 41 43 this._fileSystemPath = fileSystemPath; 42 44 this._files = {}; … … 44 46 } 45 47 46 WebInspector.FileSystem WorkspaceProvider._scriptExtensions = ["js", "java", "cc", "cpp", "h", "cs", "py", "php"].keySet();47 48 WebInspector.FileSystem WorkspaceProvider.prototype = {48 WebInspector.FileSystemProjectDelegate._scriptExtensions = ["js", "java", "cc", "cpp", "h", "cs", "py", "php"].keySet(); 49 50 WebInspector.FileSystemProjectDelegate.prototype = { 49 51 /** 50 52 * @return {string} 51 53 */ 54 id: function() 55 { 56 return this._fileSystemId; 57 }, 58 59 /** 60 * @return {string} 61 */ 52 62 type: function() 53 63 { 54 64 return WebInspector.projectTypes.FileSystem; 65 }, 66 67 /** 68 * @return {string} 69 */ 70 displayName: function() 71 { 72 return this._fileSystemPath.substr(this._fileSystemPath.lastIndexOf("/") + 1); 55 73 }, 56 74 … … 130 148 extension = fileName.substring(extensionIndex + 1); 131 149 var contentType = WebInspector.resourceTypes.Other; 132 if (WebInspector.FileSystem WorkspaceProvider._scriptExtensions[extension])150 if (WebInspector.FileSystemProjectDelegate._scriptExtensions[extension]) 133 151 return WebInspector.resourceTypes.Script; 134 152 if (extension === "css") … … 162 180 if (!this._files[this._fileSystemPath]) 163 181 this._files[this._fileSystemPath] = {}; 164 this._files[this._fileSystemPath][fileDescriptor. uri] = true;165 this.dispatchEventToListeners(WebInspector. WorkspaceProvider.Events.FileAdded, fileDescriptor);182 this._files[this._fileSystemPath][fileDescriptor.path] = true; 183 this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded, fileDescriptor); 166 184 }, 167 185 … … 174 192 if (Object.keys(this._files[this._fileSystemPath]).length === 0) 175 193 delete this._files[this._fileSystemPath]; 176 this.dispatchEventToListeners(WebInspector. WorkspaceProvider.Events.FileRemoved, uri);194 this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved, uri); 177 195 }, 178 196 179 197 reset: function() 180 198 { 181 this.dispatchEventToListeners(WebInspector. WorkspaceProvider.Events.Reset, null);199 this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset, null); 182 200 }, 183 201 … … 186 204 187 205 /** 188 * @type {?WebInspector.FileSystem WorkspaceProvider}189 */ 190 WebInspector.fileSystem WorkspaceProvider= null;206 * @type {?WebInspector.FileSystemProjectDelegate} 207 */ 208 WebInspector.fileSystemProjectDelegate = null; 191 209 192 210 /** -
trunk/Source/WebCore/inspector/front-end/IsolatedFileSystemModel.js
r142107 r142474 110 110 var fileSystemId = this._fileSystemMapping.addFileSystemMapping(fileSystemPath); 111 111 console.assert(!this._workspace.project(fileSystemId)); 112 this._workspace.addProject( fileSystemId, new WebInspector.FileSystemWorkspaceProvider(this, fileSystemPath));112 this._workspace.addProject(new WebInspector.FileSystemProjectDelegate(this, fileSystemId, fileSystemPath)); 113 113 }, 114 114 -
trunk/Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js
r142269 r142474 31 31 /** 32 32 * @constructor 33 * @implements {WebInspector.WorkspaceProvider} 33 * @implements {WebInspector.ProjectDelegate} 34 * @extends {WebInspector.Object} 35 */ 36 WebInspector.SimpleProjectDelegate = function(type) 37 { 38 this._type = type; 39 /** @type {Object.<string, WebInspector.ContentProvider>} */ 40 this._contentProviders = {}; 41 this._lastUniqueSuffix = 0; 42 } 43 44 WebInspector.SimpleProjectDelegate.prototype = { 45 /** 46 * @return {string} 47 */ 48 id: function() 49 { 50 return this._type; 51 }, 52 53 /** 54 * @return {string} 55 */ 56 type: function() 57 { 58 return this._type; 59 }, 60 61 /** 62 * @return {string} 63 */ 64 displayName: function() 65 { 66 return ""; 67 }, 68 69 /** 70 * @param {string} path 71 * @param {function(?string,boolean,string)} callback 72 */ 73 requestFileContent: function(path, callback) 74 { 75 var contentProvider = this._contentProviders[path]; 76 contentProvider.requestContent(callback); 77 }, 78 79 /** 80 * @param {string} path 81 * @param {string} newContent 82 * @param {function(?string)} callback 83 */ 84 setFileContent: function(path, newContent, callback) 85 { 86 callback(null); 87 }, 88 89 /** 90 * @param {string} query 91 * @param {boolean} caseSensitive 92 * @param {boolean} isRegex 93 * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback 94 */ 95 searchInFileContent: function(path, query, caseSensitive, isRegex, callback) 96 { 97 var contentProvider = this._contentProviders[path]; 98 contentProvider.searchInContent(query, caseSensitive, isRegex, callback); 99 }, 100 101 /** 102 * @param {string} path 103 * @param {string} url 104 * @param {WebInspector.ContentProvider} contentProvider 105 * @param {boolean} isEditable 106 * @param {boolean=} isContentScript 107 */ 108 addFile: function(path, forceUniquePath, url, contentProvider, isEditable, isContentScript) 109 { 110 if (forceUniquePath) 111 path = this._uniquePath(path); 112 console.assert(!this._contentProviders[path]); 113 var fileDescriptor = new WebInspector.FileDescriptor(path, url, url, contentProvider.contentType(), isEditable, isContentScript); 114 this._contentProviders[path] = contentProvider; 115 this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded, fileDescriptor); 116 return path; 117 }, 118 119 /** 120 * @param {string} path 121 * @return {string} 122 */ 123 _uniquePath: function(path) 124 { 125 var uniquePath = path; 126 while (this._contentProviders[uniquePath]) 127 uniquePath = path + " (" + (++this._lastUniqueSuffix) + ")"; 128 return uniquePath; 129 }, 130 131 /** 132 * @param {string} path 133 */ 134 removeFile: function(path) 135 { 136 delete this._contentProviders[path]; 137 this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved, path); 138 }, 139 140 reset: function() 141 { 142 this._contentProviders = {}; 143 this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset, null); 144 }, 145 146 __proto__: WebInspector.Object.prototype 147 } 148 149 /** 150 * @constructor 34 151 * @extends {WebInspector.Object} 35 152 * @param {WebInspector.Workspace} workspace … … 40 157 this._workspace = workspace; 41 158 this._type = type; 42 /** @type {Object.<string, WebInspector.ContentProvider>} */ 43 this._contentProviders = {}; 44 this._lastUniqueSuffix = 0; 45 this._workspace.addProject(this._type, this); 159 this._simpleProjectDelegate = new WebInspector.SimpleProjectDelegate(this._type); 160 this._workspace.addProject(this._simpleProjectDelegate); 46 161 } 47 162 48 163 /** 49 164 * @param {string} url 50 * @param {string} type51 165 * @return {string} 52 166 */ 53 167 WebInspector.SimpleWorkspaceProvider.uriForURL = function(url, type) 54 { 168 { 55 169 var uriTypePrefix = type !== WebInspector.projectTypes.Network ? (type + ":") : ""; 56 170 var uri = uriTypePrefix + url; 57 171 return uri; 58 } ,172 } 59 173 60 174 WebInspector.SimpleWorkspaceProvider.prototype = { 61 175 /** 62 * @return {string}63 */64 type: function()65 {66 return this._type;67 },68 69 /**70 * @param {string} uri71 * @param {function(?string,boolean,string)} callback72 */73 requestFileContent: function(uri, callback)74 {75 var contentProvider = this._contentProviders[uri];76 contentProvider.requestContent(callback);77 },78 79 /**80 * @param {string} uri81 * @param {string} newContent82 * @param {function(?string)} callback83 */84 setFileContent: function(uri, newContent, callback)85 {86 callback(null);87 },88 89 /**90 * @param {string} query91 * @param {boolean} caseSensitive92 * @param {boolean} isRegex93 * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback94 */95 searchInFileContent: function(uri, query, caseSensitive, isRegex, callback)96 {97 var contentProvider = this._contentProviders[uri];98 contentProvider.searchInContent(query, caseSensitive, isRegex, callback);99 },100 101 /**102 176 * @param {string} url 103 177 * @param {WebInspector.ContentProvider} contentProvider … … 129 203 _innerAddFileForURL: function(url, contentProvider, isEditable, forceUnique, isContentScript) 130 204 { 131 var uri = WebInspector.SimpleWorkspaceProvider.uriForURL(url, this._type); 132 if (forceUnique) 133 uri = this._uniqueURI(uri); 134 console.assert(!this._contentProviders[uri]); 135 var fileDescriptor = new WebInspector.FileDescriptor(uri, url, url, contentProvider.contentType(), isEditable, isContentScript); 136 this._contentProviders[uri] = contentProvider; 137 this.dispatchEventToListeners(WebInspector.WorkspaceProvider.Events.FileAdded, fileDescriptor); 138 return this._workspace.uiSourceCodeForURI(uri); 139 }, 140 141 /** 142 * @param {string} uri 143 */ 144 removeFile: function(uri) 145 { 146 delete this._contentProviders[uri]; 147 this.dispatchEventToListeners(WebInspector.WorkspaceProvider.Events.FileRemoved, uri); 148 }, 149 150 /** 151 * @param {string} uri 152 * @return {string} 153 */ 154 _uniqueURI: function(uri) 155 { 156 var uniqueURI = uri; 157 while (this._contentProviders[uniqueURI]) 158 uniqueURI = uri + " (" + (++this._lastUniqueSuffix) + ")"; 159 return uniqueURI; 205 var path = WebInspector.SimpleWorkspaceProvider.uriForURL(url, this._type); 206 path = this._simpleProjectDelegate.addFile(path, forceUnique, url, contentProvider, isEditable, isContentScript); 207 return this._workspace.uiSourceCode(this._simpleProjectDelegate.id(), path); 208 }, 209 210 /** 211 * @param {string} url 212 */ 213 removeFile: function(url) 214 { 215 var path = WebInspector.SimpleWorkspaceProvider.uriForURL(url, this._type); 216 this._simpleProjectDelegate.removeFile(path); 160 217 }, 161 218 162 219 reset: function() 163 220 { 164 this._contentProviders = {}; 165 this.dispatchEventToListeners(WebInspector.WorkspaceProvider.Events.Reset, null); 221 this._simpleProjectDelegate.reset(); 166 222 }, 167 223 -
trunk/Source/WebCore/inspector/front-end/UISourceCode.js
r142259 r142474 35 35 * @implements {WebInspector.ContentProvider} 36 36 * @param {WebInspector.Project} project 37 * @param {string} uri37 * @param {string} path 38 38 * @param {string} url 39 39 * @param {WebInspector.ResourceType} contentType 40 40 * @param {boolean} isEditable 41 41 */ 42 WebInspector.UISourceCode = function(project, uri, originURL, url, contentType, isEditable)42 WebInspector.UISourceCode = function(project, path, originURL, url, contentType, isEditable) 43 43 { 44 44 this._project = project; 45 this._ uri = uri;45 this._path = path; 46 46 this._originURL = originURL; 47 47 this._url = url; … … 94 94 * @return {string} 95 95 */ 96 path: function() 97 { 98 return this._path; 99 }, 100 101 /** 102 * @return {string} 103 */ 96 104 uri: function() 97 105 { 98 return this._ uri;106 return this._path; 99 107 }, 100 108 -
trunk/Source/WebCore/inspector/front-end/WebKit.qrc
r142471 r142474 79 79 <file>FileSystemModel.js</file> 80 80 <file>FileSystemView.js</file> 81 <file>FileSystem WorkspaceProvider.js</file>81 <file>FileSystemProjectDelegate.js</file> 82 82 <file>FileUtils.js</file> 83 83 <file>FilteredItemSelectionDialog.js</file> -
trunk/Source/WebCore/inspector/front-end/Workspace.js
r142269 r142474 50 50 /** 51 51 * @constructor 52 * @param {string} uri52 * @param {string} path 53 53 * @param {string} originURL 54 54 * @param {string} url … … 57 57 * @param {boolean=} isContentScript 58 58 */ 59 WebInspector.FileDescriptor = function( uri, originURL, url, contentType, isEditable, isContentScript)59 WebInspector.FileDescriptor = function(path, originURL, url, contentType, isEditable, isContentScript) 60 60 { 61 this. uri = uri;61 this.path = path; 62 62 this.originURL = originURL; 63 63 this.url = url; … … 70 70 * @interface 71 71 */ 72 WebInspector. WorkspaceProvider= function() { }73 74 WebInspector. WorkspaceProvider.Events = {72 WebInspector.ProjectDelegate = function() { } 73 74 WebInspector.ProjectDelegate.Events = { 75 75 FileAdded: "FileAdded", 76 76 FileRemoved: "FileRemoved", … … 78 78 } 79 79 80 WebInspector.WorkspaceProvider.prototype = { 80 WebInspector.ProjectDelegate.prototype = { 81 /** 82 * @return {string} 83 */ 84 id: function() { }, 85 81 86 /** 82 87 * @return {string} … … 85 90 86 91 /** 87 * @param {string} uri 92 * @return {string} 93 */ 94 displayName: function() { }, 95 96 /** 97 * @param {string} path 88 98 * @param {function(?string,boolean,string)} callback 89 99 */ 90 requestFileContent: function( uri, callback) { },91 92 /** 93 * @param {string} uri100 requestFileContent: function(path, callback) { }, 101 102 /** 103 * @param {string} path 94 104 * @param {string} newContent 95 105 * @param {function(?string)} callback 96 106 */ 97 setFileContent: function( uri, newContent, callback) { },98 99 /** 100 * @param {string} uri107 setFileContent: function(path, newContent, callback) { }, 108 109 /** 110 * @param {string} path 101 111 * @param {string} query 102 112 * @param {boolean} caseSensitive … … 104 114 * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback 105 115 */ 106 searchInFileContent: function( uri, query, caseSensitive, isRegex, callback) { },116 searchInFileContent: function(path, query, caseSensitive, isRegex, callback) { }, 107 117 108 118 /** … … 128 138 /** 129 139 * @param {WebInspector.Workspace} workspace 130 * @param {string} name 131 * @param {WebInspector.WorkspaceProvider} workspaceProvider 140 * @param {WebInspector.ProjectDelegate} projectDelegate 132 141 * @constructor 133 142 */ 134 WebInspector.Project = function(workspace, name, workspaceProvider)143 WebInspector.Project = function(workspace, projectDelegate) 135 144 { 136 this._name = name;137 145 /** @type {Object.<string, WebInspector.UISourceCode>} */ 138 this._uiSourceCodes ForURI= {};146 this._uiSourceCodes = {}; 139 147 this._workspace = workspace; 140 this._ workspaceProvider = workspaceProvider;141 this._ workspaceProvider.addEventListener(WebInspector.WorkspaceProvider.Events.FileAdded, this._fileAdded, this);142 this._ workspaceProvider.addEventListener(WebInspector.WorkspaceProvider.Events.FileRemoved, this._fileRemoved, this);143 this._ workspaceProvider.addEventListener(WebInspector.WorkspaceProvider.Events.Reset, this._reset, this);148 this._projectDelegate = projectDelegate; 149 this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileAdded, this._fileAdded, this); 150 this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileRemoved, this._fileRemoved, this); 151 this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.Reset, this._reset, this); 144 152 } 145 153 … … 148 156 * @return {string} 149 157 */ 150 name: function()151 { 152 return this._ name;158 id: function() 159 { 160 return this._projectDelegate.id(); 153 161 }, 154 162 … … 158 166 type: function() 159 167 { 160 return this._workspaceProvider.type(); 168 return this._projectDelegate.type(); 169 }, 170 171 /** 172 * @return {string} 173 */ 174 displayName: function() 175 { 176 return this._projectDelegate.displayName(); 161 177 }, 162 178 … … 166 182 isServiceProject: function() 167 183 { 168 return this._ workspaceProvider.type() === WebInspector.projectTypes.Debugger || this._workspaceProvider.type() === WebInspector.projectTypes.LiveEdit;184 return this._projectDelegate.type() === WebInspector.projectTypes.Debugger || this._projectDelegate.type() === WebInspector.projectTypes.LiveEdit; 169 185 }, 170 186 … … 172 188 { 173 189 var fileDescriptor = /** @type {WebInspector.FileDescriptor} */ (event.data); 174 var uiSourceCode = this.uiSourceCodeForURI(fileDescriptor. uri);190 var uiSourceCode = this.uiSourceCodeForURI(fileDescriptor.path); 175 191 if (uiSourceCode) { 176 192 // FIXME: Implement 177 193 return; 178 194 } 179 uiSourceCode = new WebInspector.UISourceCode(this, fileDescriptor. uri, fileDescriptor.originURL, fileDescriptor.url, fileDescriptor.contentType, fileDescriptor.isEditable);195 uiSourceCode = new WebInspector.UISourceCode(this, fileDescriptor.path, fileDescriptor.originURL, fileDescriptor.url, fileDescriptor.contentType, fileDescriptor.isEditable); 180 196 uiSourceCode.isContentScript = fileDescriptor.isContentScript; 181 this._uiSourceCodes ForURI[uiSourceCode.uri()] = uiSourceCode;197 this._uiSourceCodes[uiSourceCode.path()] = uiSourceCode; 182 198 this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode); 183 199 }, … … 185 201 _fileRemoved: function(event) 186 202 { 187 var uri= /** @type {string} */ (event.data);188 var uiSourceCode = this.uiSourceCodeForURI( uri);203 var path = /** @type {string} */ (event.data); 204 var uiSourceCode = this.uiSourceCodeForURI(path); 189 205 if (!uiSourceCode) 190 206 return; 191 delete this._uiSourceCodes ForURI[uiSourceCode.uri()];207 delete this._uiSourceCodes[uiSourceCode.path()]; 192 208 this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, uiSourceCode); 193 209 }, … … 196 212 { 197 213 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectWillReset, this); 198 this._uiSourceCodesForURI = {}; 214 this._uiSourceCodes = {}; 215 }, 216 217 /** 218 * @param {string} path 219 * @return {?WebInspector.UISourceCode} 220 */ 221 uiSourceCode: function(path) 222 { 223 return this._uiSourceCodes[path] || null; 199 224 }, 200 225 … … 205 230 uiSourceCodeForOriginURL: function(originURL) 206 231 { 207 for (var uri in this._uiSourceCodesForURI) {208 var uiSourceCode = this._uiSourceCodes ForURI[uri];232 for (var path in this._uiSourceCodes) { 233 var uiSourceCode = this._uiSourceCodes[path]; 209 234 if (uiSourceCode.originURL() === originURL) 210 235 return uiSourceCode; … … 219 244 uiSourceCodeForURI: function(uri) 220 245 { 221 return this. _uiSourceCodesForURI[uri];246 return this.uiSourceCode(uri); 222 247 }, 223 248 … … 227 252 uiSourceCodes: function() 228 253 { 229 return Object.values(this._uiSourceCodes ForURI);254 return Object.values(this._uiSourceCodes); 230 255 }, 231 256 … … 236 261 requestFileContent: function(uiSourceCode, callback) 237 262 { 238 this._ workspaceProvider.requestFileContent(uiSourceCode.uri(), callback);263 this._projectDelegate.requestFileContent(uiSourceCode.path(), callback); 239 264 }, 240 265 … … 246 271 setFileContent: function(uiSourceCode, newContent, callback) 247 272 { 248 this._ workspaceProvider.setFileContent(uiSourceCode.uri(), newContent, callback);273 this._projectDelegate.setFileContent(uiSourceCode.path(), newContent, callback); 249 274 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: uiSourceCode, content: newContent }); 250 275 }, … … 259 284 searchInFileContent: function(uiSourceCode, query, caseSensitive, isRegex, callback) 260 285 { 261 this._ workspaceProvider.searchInFileContent(uiSourceCode.uri(), query, caseSensitive, isRegex, callback);286 this._projectDelegate.searchInFileContent(uiSourceCode.path(), query, caseSensitive, isRegex, callback); 262 287 }, 263 288 264 289 dispose: function() 265 290 { 266 this._ workspaceProvider.reset();291 this._projectDelegate.reset(); 267 292 } 268 293 } … … 295 320 WebInspector.Workspace.prototype = { 296 321 /** 322 * @param {string} projectId 323 * @param {string} path 324 * @return {?WebInspector.UISourceCode} 325 */ 326 uiSourceCode: function(projectId, path) 327 { 328 var project = this._projects[projectId]; 329 return project ? project.uiSourceCode(path) : null; 330 }, 331 332 /** 297 333 * @param {string} originURL 298 334 * @return {?WebInspector.UISourceCode} … … 316 352 uiSourceCodeForURI: function(uri) 317 353 { 318 for (var project Namein this._projects) {319 var project = this._projects[project Name];354 for (var projectId in this._projects) { 355 var project = this._projects[projectId]; 320 356 var uiSourceCode = project.uiSourceCodeForURI(uri); 321 357 if (uiSourceCode) … … 341 377 342 378 /** 343 * @param {string} projectName 344 * @param {WebInspector.WorkspaceProvider} workspaceProvider 379 * @param {WebInspector.ProjectDelegate} projectDelegate 345 380 * @return {WebInspector.Project} 346 381 */ 347 addProject: function(projectName, workspaceProvider) 348 { 349 this._projects[projectName] = new WebInspector.Project(this, projectName, workspaceProvider); 350 return this._projects[projectName]; 351 }, 352 353 /** 354 * @param {string} projectName 355 */ 356 removeProject: function(projectName) 357 { 358 var project = this._projects[projectName]; 382 addProject: function(projectDelegate) 383 { 384 var projectId = projectDelegate.id(); 385 this._projects[projectId] = new WebInspector.Project(this, projectDelegate); 386 return this._projects[projectId]; 387 }, 388 389 /** 390 * @param {string} projectId 391 */ 392 removeProject: function(projectId) 393 { 394 var project = this._projects[projectId]; 359 395 if (!project) 360 396 return; 361 397 project.dispose(); 362 delete this._projects[project Name];363 }, 364 365 /** 366 * @param {string} project Name398 delete this._projects[projectId]; 399 }, 400 401 /** 402 * @param {string} projectId 367 403 * @return {WebInspector.Project} 368 404 */ 369 project: function(project Name)370 { 371 return this._projects[project Name];405 project: function(projectId) 406 { 407 return this._projects[projectId]; 372 408 }, 373 409 … … 399 435 { 400 436 var result = []; 401 for (var project Namein this._projects) {402 var project = this._projects[project Name];437 for (var projectId in this._projects) { 438 var project = this._projects[projectId]; 403 439 result = result.concat(project.uiSourceCodes()); 404 440 } … … 411 447 projectForUISourceCode: function(uiSourceCode) 412 448 { 413 for (var project Namein this._projects) {414 var project = this._projects[project Name];449 for (var projectId in this._projects) { 450 var project = this._projects[projectId]; 415 451 if (project.uiSourceCodeForURI(uiSourceCode.uri())) 416 452 return project; -
trunk/Source/WebCore/inspector/front-end/inspector.html
r142471 r142474 140 140 <script type="text/javascript" src="DebuggerScriptMapping.js"></script> 141 141 <script type="text/javascript" src="PresentationConsoleMessageHelper.js"></script> 142 <script type="text/javascript" src="FileSystem WorkspaceProvider.js"></script>142 <script type="text/javascript" src="FileSystemProjectDelegate.js"></script> 143 143 <script type="text/javascript" src="FileSystemMapping.js"></script> 144 144 <script type="text/javascript" src="IsolatedFileSystemModel.js"></script>
Note: See TracChangeset
for help on using the changeset viewer.