1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

Use ArrayDeque instead of LinkedList.

This commit is contained in:
Sergey Prigogin 2012-05-06 17:20:06 -07:00
parent ad6104f082
commit 6c33857abf

View file

@ -20,11 +20,11 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -139,17 +139,17 @@ public class PDOMManager implements IWritableIndexManager, IListener {
ILinkage.C_LINKAGE_ID, ILinkage.CPP_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID ILinkage.C_LINKAGE_ID, ILinkage.CPP_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID
}; };
private final LinkedList<ICProject> fProjectQueue= new LinkedList<ICProject>(); private final ArrayDeque<ICProject> fProjectQueue= new ArrayDeque<ICProject>();
private final PDOMSetupJob fSetupJob; private final PDOMSetupJob fSetupJob;
/** /**
* Protects fIndexerJob, fCurrentTask and fTaskQueue. * Protects fIndexerJob, fCurrentTask and fTaskQueue.
*/ */
private final LinkedList<IPDOMIndexerTask> fTaskQueue = new LinkedList<IPDOMIndexerTask>(); private final ArrayDeque<IPDOMIndexerTask> fTaskQueue = new ArrayDeque<IPDOMIndexerTask>();
private final PDOMIndexerJob fIndexerJob; private final PDOMIndexerJob fIndexerJob;
private IPDOMIndexerTask fCurrentTask; private IPDOMIndexerTask fCurrentTask;
private int fSourceCount, fHeaderCount, fTickCount; private int fSourceCount, fHeaderCount, fTickCount;
private final LinkedList<Runnable> fChangeEvents= new LinkedList<Runnable>(); private final ArrayDeque<Runnable> fChangeEvents= new ArrayDeque<Runnable>();
private final Job fNotificationJob; private final Job fNotificationJob;
private final AtomicMultiSet<IIndexFileLocation> fFilesIndexedUnconditionlly= new AtomicMultiSet<IIndexFileLocation>(); private final AtomicMultiSet<IIndexFileLocation> fFilesIndexedUnconditionlly= new AtomicMultiSet<IIndexFileLocation>();
@ -1513,10 +1513,10 @@ public class PDOMManager implements IWritableIndexManager, IListener {
IIndex index= getIndex(cproject); IIndex index= getIndex(cproject);
index.acquireReadLock(); index.acquireReadLock();
try { try {
for(ITranslationUnit tu : sources) { for (ITranslationUnit tu : sources) {
IResource resource= tu.getResource(); IResource resource= tu.getResource();
if (resource instanceof IFile && isSubjectToIndexing(tu.getLanguage())) { if (resource instanceof IFile && isSubjectToIndexing(tu.getLanguage())) {
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile)resource); IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile) resource);
if (!areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location)) { if (!areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location)) {
return false; return false;
} }
@ -1566,7 +1566,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
// if it is up-to-date, the includes have not changed and may // if it is up-to-date, the includes have not changed and may
// be read from the index. // be read from the index.
IIndexInclude[] includes= index.findIncludes(file[0]); IIndexInclude[] includes= index.findIncludes(file[0]);
for(IIndexInclude inc : includes) { for (IIndexInclude inc : includes) {
IIndexFileLocation newLocation= inc.getIncludesLocation(); IIndexFileLocation newLocation= inc.getIncludesLocation();
if (newLocation != null) { if (newLocation != null) {
String path= newLocation.getFullPath(); String path= newLocation.getFullPath();