Chromium Code Reviews| Index: Source/devtools/front_end/SourcesSearchScope.js |
| diff --git a/Source/devtools/front_end/SourcesSearchScope.js b/Source/devtools/front_end/SourcesSearchScope.js |
| index 60f731164a95c323543f118aa35c848b29825ea7..f18564dc9b15a987e2f359b525e47eea33356a11 100644 |
| --- a/Source/devtools/front_end/SourcesSearchScope.js |
| +++ b/Source/devtools/front_end/SourcesSearchScope.js |
| @@ -115,6 +115,8 @@ WebInspector.SourcesSearchScope.prototype = { |
| return; |
| } |
| + addDirtyFiles(); |
| + |
| if (!files.length) { |
| progress.done(); |
| callback(); |
| @@ -130,6 +132,34 @@ WebInspector.SourcesSearchScope.prototype = { |
| for (var i = 0; i < maxFileContentRequests && i < files.length; ++i) |
| scheduleSearchInNextFileOrFinish.call(this); |
| + function addDirtyFiles() |
| + { |
| + var matchingFiles = new StringSet(); |
| + files.forEach(function(file) { |
| + matchingFiles.put(file); |
|
vsevik
2014/03/28 16:18:36
Can we use matchingFiles.put.bind(matchingFiles) i
apavlov
2014/03/30 13:02:09
Done.
|
| + }); |
| + |
| + project.uiSourceCodes().filter(dirtySourceCodeFilter).forEach(appendFilePath); |
| + |
| + /** |
| + * @param {!WebInspector.UISourceCode} sourceCode |
|
vsevik
2014/03/28 16:18:36
s/sourceCode/uiSourceCode
apavlov
2014/03/30 13:02:09
Saw sourceCode somewhere
|
| + */ |
| + function dirtySourceCodeFilter(sourceCode) |
| + { |
| + return sourceCode.isDirty(); |
| + } |
| + |
| + /** |
| + * @param {!WebInspector.UISourceCode} sourceCode |
| + */ |
| + function appendFilePath(sourceCode) |
| + { |
| + var path = sourceCode.path(); |
| + if (!matchingFiles.contains(path)) |
| + files.push(path); |
| + } |
| + } |
| + |
| /** |
| * @param {!string} path |
| * @this {WebInspector.SourcesSearchScope} |
| @@ -143,7 +173,19 @@ WebInspector.SourcesSearchScope.prototype = { |
| scheduleSearchInNextFileOrFinish.call(this); |
| return; |
| } |
| - uiSourceCode.requestContent(contentLoaded.bind(this, path)); |
| + if (uiSourceCode.isDirty()) |
| + contentLoaded.call(this, uiSourceCode.path(), uiSourceCode.workingCopy()); |
| + else |
| + uiSourceCode.checkContentUpdated(contentUpdated.bind(this, uiSourceCode)); |
| + } |
| + |
| + /** |
| + * @param {!WebInspector.UISourceCode} uiSourceCode |
| + * @this {WebInspector.SourcesSearchScope} |
| + */ |
| + function contentUpdated(uiSourceCode) |
| + { |
| + uiSourceCode.requestContent(contentLoaded.bind(this, uiSourceCode.path())); |
| } |
| /** |