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..e9a5fb3d060e9b75e5a55b316f2261c8fe220e79 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,32 @@ WebInspector.SourcesSearchScope.prototype = { |
for (var i = 0; i < maxFileContentRequests && i < files.length; ++i) |
scheduleSearchInNextFileOrFinish.call(this); |
+ function addDirtyFiles() |
+ { |
+ var matchingFiles = new StringSet(); |
+ files.forEach(matchingFiles.put.bind(matchingFiles)); |
pfeldman
2014/03/31 19:20:51
While you are here, could you rename StringSet's p
apavlov
2014/04/01 07:26:00
Done.
|
+ |
+ project.uiSourceCodes().filter(dirtySourceCodeFilter).forEach(appendFilePath); |
pfeldman
2014/03/31 19:20:51
my 8 lines against your 20
var uiSourceCodes = pr
apavlov
2014/04/01 07:26:00
Accepted!
|
+ |
+ /** |
+ * @param {!WebInspector.UISourceCode} uiSourceCode |
+ */ |
+ function dirtySourceCodeFilter(uiSourceCode) |
+ { |
+ return uiSourceCode.isDirty(); |
+ } |
+ |
+ /** |
+ * @param {!WebInspector.UISourceCode} uiSourceCode |
+ */ |
+ function appendFilePath(uiSourceCode) |
+ { |
+ var path = uiSourceCode.path(); |
+ if (!matchingFiles.contains(path)) |
+ files.push(path); |
+ } |
+ } |
+ |
/** |
* @param {!string} path |
* @this {WebInspector.SourcesSearchScope} |
@@ -143,7 +171,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())); |
pfeldman
2014/03/31 19:20:51
... and when do we start using promises once again
apavlov
2014/04/01 07:26:00
Uhm... We've never used them... and will not, I pr
|
} |
/** |