perf: avoid redundant map lookup in WebContents::DevToolsIndexPath() (#46296)
		
	perf: avoid double map lookup in WebContents::DevToolsIndexPath() Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
		
					parent
					
						
							
								3023f14bdd
							
						
					
				
			
			
				commit
				
					
						cd5da1b933
					
				
			
		
					 1 changed files with 16 additions and 14 deletions
				
			
		|  | @ -4213,8 +4213,11 @@ void WebContents::DevToolsIndexPath( | ||||||
|     OnDevToolsIndexingDone(request_id, file_system_path); |     OnDevToolsIndexingDone(request_id, file_system_path); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if (devtools_indexing_jobs_.contains(request_id)) | 
 | ||||||
|  |   auto& indexing_job = devtools_indexing_jobs_[request_id]; | ||||||
|  |   if (indexing_job) | ||||||
|     return; |     return; | ||||||
|  | 
 | ||||||
|   std::vector<std::string> excluded_folders; |   std::vector<std::string> excluded_folders; | ||||||
|   std::optional<base::Value> parsed_excluded_folders = |   std::optional<base::Value> parsed_excluded_folders = | ||||||
|       base::JSONReader::Read(excluded_folders_message); |       base::JSONReader::Read(excluded_folders_message); | ||||||
|  | @ -4224,19 +4227,18 @@ void WebContents::DevToolsIndexPath( | ||||||
|         excluded_folders.push_back(folder_path.GetString()); |         excluded_folders.push_back(folder_path.GetString()); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   devtools_indexing_jobs_[request_id] = | 
 | ||||||
|       scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>( |   indexing_job = devtools_file_system_indexer_->IndexPath( | ||||||
|           devtools_file_system_indexer_->IndexPath( |  | ||||||
|       file_system_path, excluded_folders, |       file_system_path, excluded_folders, | ||||||
|               base::BindRepeating( |       base::BindRepeating(&WebContents::OnDevToolsIndexingWorkCalculated, | ||||||
|                   &WebContents::OnDevToolsIndexingWorkCalculated, |                           weak_factory_.GetWeakPtr(), request_id, | ||||||
|                   weak_factory_.GetWeakPtr(), request_id, file_system_path), |                           file_system_path), | ||||||
|       base::BindRepeating(&WebContents::OnDevToolsIndexingWorked, |       base::BindRepeating(&WebContents::OnDevToolsIndexingWorked, | ||||||
|                           weak_factory_.GetWeakPtr(), request_id, |                           weak_factory_.GetWeakPtr(), request_id, | ||||||
|                           file_system_path), |                           file_system_path), | ||||||
|       base::BindRepeating(&WebContents::OnDevToolsIndexingDone, |       base::BindRepeating(&WebContents::OnDevToolsIndexingDone, | ||||||
|                           weak_factory_.GetWeakPtr(), request_id, |                           weak_factory_.GetWeakPtr(), request_id, | ||||||
|                                   file_system_path))); |                           file_system_path)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WebContents::DevToolsStopIndexing(int request_id) { | void WebContents::DevToolsStopIndexing(int request_id) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	![37223003+trop[bot]@users.noreply.github.com](/assets/img/avatar_default.png) trop[bot]
				trop[bot]