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

Unified Diff: Source/devtools/front_end/SourcesSearchScope.js

Issue 216183003: DevTools: Make sure UISC content is up-to-date when running performSearchInContent() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Introduce callback array for pending requests Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/ResourceScriptMapping.js ('k') | Source/devtools/front_end/UISourceCode.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f62364120061cb4c282661f47315cee7965b75f8 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,19 @@ WebInspector.SourcesSearchScope.prototype = {
for (var i = 0; i < maxFileContentRequests && i < files.length; ++i)
scheduleSearchInNextFileOrFinish.call(this);
+ function addDirtyFiles()
+ {
+ var matchingFiles = StringSet.fromArray(files);
+ var uiSourceCodes = project.uiSourceCodes();
+ for (var i = 0; i < uiSourceCodes.length; ++i) {
+ if (!uiSourceCodes[i].isDirty())
+ continue;
+ var path = uiSourceCodes[i].path();
+ if (!matchingFiles.contains(path))
+ files.push(path);
+ }
+ }
+
/**
* @param {!string} path
* @this {WebInspector.SourcesSearchScope}
@@ -143,7 +158,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()));
}
/**
« no previous file with comments | « Source/devtools/front_end/ResourceScriptMapping.js ('k') | Source/devtools/front_end/UISourceCode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698