Index: Source/devtools/blink/chromeServerProfile/Default/Cache/f_00005d |
diff --git a/Source/devtools/front_end/Workspace.js b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_00005d |
similarity index 87% |
copy from Source/devtools/front_end/Workspace.js |
copy to Source/devtools/blink/chromeServerProfile/Default/Cache/f_00005d |
index d444fe67b25435336893c521de8cd7db43b608c8..e54f2abf56a328b3ccc2962c33fddb8ddb1c7924 100644 |
--- a/Source/devtools/front_end/Workspace.js |
+++ b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_00005d |
@@ -51,13 +51,25 @@ WebInspector.FileDescriptor = function(parentPath, name, originURL, url, content |
/** |
* @interface |
+ * @extends {WebInspector.EventTarget} |
*/ |
WebInspector.ProjectDelegate = function() { } |
+WebInspector.ProjectDelegate.Events = { |
+ FileAdded: "FileAdded", |
+ FileRemoved: "FileRemoved", |
+ Reset: "Reset", |
+} |
+ |
WebInspector.ProjectDelegate.prototype = { |
/** |
* @return {string} |
*/ |
+ id: function() { }, |
+ |
+ /** |
+ * @return {string} |
+ */ |
type: function() { }, |
/** |
@@ -136,112 +148,39 @@ WebInspector.ProjectDelegate.prototype = { |
searchInFileContent: function(path, query, caseSensitive, isRegex, callback) { }, |
/** |
- * @param {!WebInspector.ProjectSearchConfig} searchConfig |
+ * @param {!Array.<string>} queries |
+ * @param {!Array.<string>} fileQueries |
+ * @param {boolean} caseSensitive |
+ * @param {boolean} isRegex |
* @param {!WebInspector.Progress} progress |
* @param {function(!Array.<string>)} callback |
*/ |
- findFilesMatchingSearchRequest: function(searchConfig, progress, callback) { }, |
+ findFilesMatchingSearchRequest: function(queries, fileQueries, caseSensitive, isRegex, progress, callback) { }, |
/** |
* @param {!WebInspector.Progress} progress |
+ * @param {function()} callback |
*/ |
- indexContent: function(progress) { } |
-} |
- |
-/** |
- * @interface |
- */ |
-WebInspector.ProjectSearchConfig = function() {} |
- |
-WebInspector.ProjectSearchConfig.prototype = { |
- /** |
- * @return {string} |
- */ |
- query: function() { }, |
- |
- /** |
- * @return {boolean} |
- */ |
- ignoreCase: function() { }, |
- |
- /** |
- * @return {boolean} |
- */ |
- isRegex: function() { }, |
- |
- /** |
- * @return {!Array.<string>} |
- */ |
- fileQueries: function() { }, |
- |
- /** |
- * @return {!Array.<string>} |
- */ |
- queries: function() { }, |
- |
- /** |
- * @param {string} filePath |
- * @return {boolean} |
- */ |
- filePathMatchesFileQuery: function(filePath) { } |
-} |
- |
-/** |
- * @constructor |
- * @param {!WebInspector.Project} project |
- */ |
-WebInspector.ProjectStore = function(project) |
-{ |
- this._project = project; |
-} |
- |
-WebInspector.ProjectStore.prototype = { |
- /** |
- * @param {!WebInspector.FileDescriptor} fileDescriptor |
- */ |
- addFile: function(fileDescriptor) |
- { |
- this._project._addFile(fileDescriptor); |
- }, |
- |
- /** |
- * @param {string} path |
- */ |
- removeFile: function(path) |
- { |
- this._project._removeFile(path); |
- }, |
- |
- reset: function() |
- { |
- this._project._reset(); |
- }, |
- |
- /** |
- * @return {!WebInspector.Project} |
- */ |
- project: function() |
- { |
- return this._project; |
- } |
+ indexContent: function(progress, callback) { } |
} |
/** |
* @param {!WebInspector.Workspace} workspace |
- * @param {string} projectId |
* @param {!WebInspector.ProjectDelegate} projectDelegate |
* @constructor |
*/ |
-WebInspector.Project = function(workspace, projectId, projectDelegate) |
+WebInspector.Project = function(workspace, projectDelegate) |
{ |
/** @type {!Object.<string, !{uiSourceCode: !WebInspector.UISourceCode, index: number}>} */ |
this._uiSourceCodesMap = {}; |
/** @type {!Array.<!WebInspector.UISourceCode>} */ |
this._uiSourceCodesList = []; |
this._workspace = workspace; |
- this._projectId = projectId; |
this._projectDelegate = projectDelegate; |
this._displayName = this._projectDelegate.displayName(); |
+ this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileAdded, this._fileAdded, this); |
+ this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileRemoved, this._fileRemoved, this); |
+ this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.Reset, this._reset, this); |
} |
WebInspector.Project.prototype = { |
@@ -250,7 +189,7 @@ WebInspector.Project.prototype = { |
*/ |
id: function() |
{ |
- return this._projectId; |
+ return this._projectDelegate.id(); |
}, |
/** |
@@ -277,11 +216,9 @@ WebInspector.Project.prototype = { |
return this._projectDelegate.type() === WebInspector.projectTypes.Debugger || this._projectDelegate.type() === WebInspector.projectTypes.Formatter || this._projectDelegate.type() === WebInspector.projectTypes.LiveEdit; |
}, |
- /** |
- * @param {!WebInspector.FileDescriptor} fileDescriptor |
- */ |
- _addFile: function(fileDescriptor) |
+ _fileAdded: function(event) |
{ |
+ var fileDescriptor = /** @type {!WebInspector.FileDescriptor} */ (event.data); |
var path = fileDescriptor.parentPath ? fileDescriptor.parentPath + "/" + fileDescriptor.name : fileDescriptor.name; |
var uiSourceCode = this.uiSourceCode(path); |
if (uiSourceCode) |
@@ -295,6 +232,12 @@ WebInspector.Project.prototype = { |
this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeAdded, uiSourceCode); |
}, |
+ _fileRemoved: function(event) |
+ { |
+ var path = /** @type {string} */ (event.data); |
+ this._removeFile(path); |
+ }, |
+ |
/** |
* @param {string} path |
*/ |
@@ -515,21 +458,30 @@ WebInspector.Project.prototype = { |
}, |
/** |
- * @param {!WebInspector.ProjectSearchConfig} searchConfig |
+ * @param {!Array.<string>} queries |
+ * @param {!Array.<string>} fileQueries |
+ * @param {boolean} caseSensitive |
+ * @param {boolean} isRegex |
* @param {!WebInspector.Progress} progress |
* @param {function(!Array.<string>)} callback |
*/ |
- findFilesMatchingSearchRequest: function(searchConfig, progress, callback) |
+ findFilesMatchingSearchRequest: function(queries, fileQueries, caseSensitive, isRegex, progress, callback) |
{ |
- this._projectDelegate.findFilesMatchingSearchRequest(searchConfig, progress, callback); |
+ this._projectDelegate.findFilesMatchingSearchRequest(queries, fileQueries, caseSensitive, isRegex, progress, callback); |
}, |
/** |
* @param {!WebInspector.Progress} progress |
+ * @param {function()} callback |
*/ |
- indexContent: function(progress) |
+ indexContent: function(progress, callback) |
{ |
- this._projectDelegate.indexContent(progress); |
+ this._projectDelegate.indexContent(progress, callback); |
+ }, |
+ |
+ dispose: function() |
+ { |
+ this._projectDelegate.reset(); |
} |
} |
@@ -618,16 +570,14 @@ WebInspector.Workspace.prototype = { |
}, |
/** |
- * @param {string} projectId |
* @param {!WebInspector.ProjectDelegate} projectDelegate |
- * @return {!WebInspector.ProjectStore} |
+ * @return {!WebInspector.Project} |
*/ |
- addProject: function(projectId, projectDelegate) |
+ addProject: function(projectDelegate) |
{ |
- var project = new WebInspector.Project(this, projectId, projectDelegate); |
- this._projects[projectId] = project; |
- var projectStore = new WebInspector.ProjectStore(project); |
- return projectStore; |
+ var projectId = projectDelegate.id(); |
+ this._projects[projectId] = new WebInspector.Project(this, projectDelegate); |
+ return this._projects[projectId]; |
}, |
/** |
@@ -638,6 +588,7 @@ WebInspector.Workspace.prototype = { |
var project = this._projects[projectId]; |
if (!project) |
return; |
+ project.dispose(); |
delete this._projects[projectId]; |
}, |
@@ -700,7 +651,7 @@ WebInspector.Workspace.prototype = { |
_networkUISourceCodeForURL: function(url) |
{ |
var splitURL = WebInspector.ParsedURL.splitURL(url); |
- var projectId = splitURL[0]; |
+ var projectId = WebInspector.SimpleProjectDelegate.projectId(splitURL[0], WebInspector.projectTypes.Network); |
var project = this.project(projectId); |
return project ? project.uiSourceCode(splitURL.slice(1).join("/")) : null; |
}, |
@@ -715,7 +666,7 @@ WebInspector.Workspace.prototype = { |
if (!file) |
return this._networkUISourceCodeForURL(url); |
- var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(file.fileSystemPath); |
+ var projectId = WebInspector.FileSystemProjectDelegate.projectId(file.fileSystemPath); |
var project = this.project(projectId); |
return project ? project.uiSourceCode(file.filePath) : null; |
}, |
@@ -733,13 +684,13 @@ WebInspector.Workspace.prototype = { |
/** |
* @param {!WebInspector.UISourceCode} networkUISourceCode |
* @param {!WebInspector.UISourceCode} uiSourceCode |
- * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding |
+ * @param {!WebInspector.FileSystemWorkspaceProvider} fileSystemWorkspaceProvider |
*/ |
- addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceBinding) |
+ addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceProvider) |
{ |
var url = networkUISourceCode.url; |
var path = uiSourceCode.path(); |
- var fileSystemPath = fileSystemWorkspaceBinding.fileSystemPath(uiSourceCode.project().id()); |
+ var fileSystemPath = fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode); |
this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path); |
}, |