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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesSearchScope.js

Issue 1564113003: DevTools: merge uisourcecode's url-alike members. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 10 *
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 */ 141 */
142 _projectFilesMatchingFileQuery: function(project, searchConfig, dirtyOnly) 142 _projectFilesMatchingFileQuery: function(project, searchConfig, dirtyOnly)
143 { 143 {
144 var result = []; 144 var result = [];
145 var uiSourceCodes = project.uiSourceCodes(); 145 var uiSourceCodes = project.uiSourceCodes();
146 for (var i = 0; i < uiSourceCodes.length; ++i) { 146 for (var i = 0; i < uiSourceCodes.length; ++i) {
147 var uiSourceCode = uiSourceCodes[i]; 147 var uiSourceCode = uiSourceCodes[i];
148 if (dirtyOnly && !uiSourceCode.isDirty()) 148 if (dirtyOnly && !uiSourceCode.isDirty())
149 continue; 149 continue;
150 if (this._searchConfig.filePathMatchesFileQuery(uiSourceCode.fullDis playName())) 150 if (this._searchConfig.filePathMatchesFileQuery(uiSourceCode.fullDis playName()))
151 result.push(uiSourceCode.path()); 151 result.push(uiSourceCode.url());
152 } 152 }
153 result.sort(String.naturalOrderComparator); 153 result.sort(String.naturalOrderComparator);
154 return result; 154 return result;
155 }, 155 },
156 156
157 /** 157 /**
158 * @param {number} searchId 158 * @param {number} searchId
159 * @param {!WebInspector.Project} project 159 * @param {!WebInspector.Project} project
160 * @param {!Array.<string>} filesMathingFileQuery 160 * @param {!Array.<string>} filesMathingFileQuery
161 * @param {function()} callback 161 * @param {function()} callback
162 * @param {!Array.<string>} files 162 * @param {!Array.<string>} files
163 */ 163 */
164 _processMatchingFilesForProject: function(searchId, project, filesMathingFil eQuery, callback, files) 164 _processMatchingFilesForProject: function(searchId, project, filesMathingFil eQuery, callback, files)
165 { 165 {
166 if (searchId !== this._searchId) { 166 if (searchId !== this._searchId) {
167 this._searchFinishedCallback(false); 167 this._searchFinishedCallback(false);
168 return; 168 return;
169 } 169 }
170 170
171 files.sort(String.naturalOrderComparator); 171 files.sort(String.naturalOrderComparator);
172 files = files.intersectOrdered(filesMathingFileQuery, String.naturalOrde rComparator); 172 files = files.intersectOrdered(filesMathingFileQuery, String.naturalOrde rComparator);
173 var dirtyFiles = this._projectFilesMatchingFileQuery(project, this._sear chConfig, true); 173 var dirtyFiles = this._projectFilesMatchingFileQuery(project, this._sear chConfig, true);
174 files = files.mergeOrdered(dirtyFiles, String.naturalOrderComparator); 174 files = files.mergeOrdered(dirtyFiles, String.naturalOrderComparator);
175 175
176 var uiSourceCodes = []; 176 var uiSourceCodes = [];
177 for (var i = 0; i < files.length; ++i) { 177 for (var i = 0; i < files.length; ++i) {
178 var uiSourceCode = project.uiSourceCode(files[i]); 178 var uiSourceCode = project.uiSourceCodeForURL(files[i]);
179 if (uiSourceCode) 179 if (uiSourceCode)
180 uiSourceCodes.push(uiSourceCode); 180 uiSourceCodes.push(uiSourceCode);
181 } 181 }
182 uiSourceCodes.sort(WebInspector.SourcesSearchScope._filesComparator); 182 uiSourceCodes.sort(WebInspector.SourcesSearchScope._filesComparator);
183 this._searchResultCandidates = this._searchResultCandidates.mergeOrdered (uiSourceCodes, WebInspector.SourcesSearchScope._filesComparator); 183 this._searchResultCandidates = this._searchResultCandidates.mergeOrdered (uiSourceCodes, WebInspector.SourcesSearchScope._filesComparator);
184 callback(); 184 callback();
185 }, 185 },
186 186
187 /** 187 /**
188 * @param {number} searchId 188 * @param {number} searchId
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 /** 298 /**
299 * @override 299 * @override
300 * @param {!WebInspector.ProjectSearchConfig} searchConfig 300 * @param {!WebInspector.ProjectSearchConfig} searchConfig
301 * @return {!WebInspector.FileBasedSearchResultsPane} 301 * @return {!WebInspector.FileBasedSearchResultsPane}
302 */ 302 */
303 createSearchResultsPane: function(searchConfig) 303 createSearchResultsPane: function(searchConfig)
304 { 304 {
305 return new WebInspector.FileBasedSearchResultsPane(searchConfig); 305 return new WebInspector.FileBasedSearchResultsPane(searchConfig);
306 } 306 }
307 } 307 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698