mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
spare cpu cycles during indexing by not allocating tons of NonCancelableIndicator and not calculating their native hashCode
This commit is contained in:
@@ -167,7 +167,7 @@ public class CoreProgressManager extends ProgressManager implements Disposable {
|
||||
|
||||
@Override
|
||||
public void executeNonCancelableSection(@NotNull Runnable runnable) {
|
||||
executeProcessUnderProgress(runnable, new NonCancelableIndicator());
|
||||
executeProcessUnderProgress(runnable, NonCancelableIndicator.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,16 @@ import com.intellij.openapi.progress.StandardProgressIndicator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class NonCancelableIndicator implements NonCancelableSection, StandardProgressIndicator {
|
||||
static final NonCancelableIndicator INSTANCE = new NonCancelableIndicator() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
protected NonCancelableIndicator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done() {
|
||||
ProgressIndicator currentIndicator = ProgressManager.getInstance().getProgressIndicator();
|
||||
|
||||
Reference in New Issue
Block a user