remove experimental registerPostStartupDumbAwareActivity

GitOrigin-RevId: d352ad7980749140bf52f7ad1dec37e70750bfc1
This commit is contained in:
Vladimir Krivosheev
2020-05-31 15:21:09 +03:00
committed by intellij-monorepo-bot
parent 735f01ce05
commit 9df95ee092
20 changed files with 140 additions and 211 deletions
@@ -1,30 +1,14 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.codeInsight.daemon;
import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.NonAsciiCharactersInspection;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class NonAsciiCharactersTest extends DaemonAnalyzerTestCase {
@NonNls private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/nonAsciiCharacters";
private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/nonAsciiCharacters";
@Override
protected LocalInspectionTool @NotNull [] configureLocalInspectionTools() {
@@ -1,3 +1,7 @@
# 22
* `project dumb post-startup` -> `project post-startup`
# 21
* `tasks waiting` removed. No such activity anymore.
@@ -7,7 +7,7 @@
"build": "vue-cli-service build"
},
"dependencies": {
"@amcharts/amcharts4": "4.9.22",
"@amcharts/amcharts4": "4.9.24",
"chokidar": "^3.4.0",
"compare-versions": "^3.6.0",
"debounce": "^1.2.0",
@@ -17,15 +17,15 @@
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-property-decorator": "^8.4.2",
"vue-router": "^3.1.6",
"vue-router": "^3.3.2",
"vuex": "^3.4.0",
"vuex-persist": "^2.2.0"
},
"devDependencies": {
"@types/debounce": "^1.2.0",
"@vue/cli-plugin-typescript": "^4.3.1",
"@vue/cli-service": "^4.3.1",
"typescript": "^3.9.2",
"@vue/cli-plugin-typescript": "^4.4.1",
"@vue/cli-service": "^4.4.1",
"typescript": "^3.9.3",
"vue-template-compiler": "^2.6.11",
"vuex-module-decorators": "^0.17.0"
},
@@ -2,10 +2,10 @@
# yarn lockfile v1
"@amcharts/amcharts4@4.9.22":
version "4.9.22"
resolved "https://registry.yarnpkg.com/@amcharts/amcharts4/-/amcharts4-4.9.22.tgz#c9ce751d52f82c3adf0ecfbb1e1262a4eb5d3aff"
integrity sha512-7Q8/LpBzkipOvUJjHMCkusnv+4juQAjLIsqs79XyE8ujfjtBwrLSv6btskMqdFCNoAkUUl2nnndMUiBrnj7WQQ==
"@amcharts/amcharts4@4.9.24":
version "4.9.24"
resolved "https://registry.yarnpkg.com/@amcharts/amcharts4/-/amcharts4-4.9.24.tgz#39aee823047edd6af9e35521fd276df678d1797f"
integrity sha512-ZQMLjPVCei/8+hvzNeMp+vP/bJhmnyLGoK+OnF0OR2zFekHEN8M2GAyKP+5XrQkFaujeqMvr8l3awPs+jLXvHQ==
dependencies:
"@babel/runtime" "^7.6.3"
"@types/regression" "^2.0.0"
@@ -45,9 +45,9 @@
js-tokens "^4.0.0"
"@babel/runtime@^7.6.3":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.1.tgz#b6eb75cac279588d3100baecd1b9894ea2840822"
integrity sha512-nQbbCbQc9u/rpg1XCxoMYQTbSMVZjCDxErQ1ClCn9Pvcmv1lGads19ep0a2VsEiIJeHqjZley6EQGEC3Yo1xMA==
version "7.10.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.2.tgz#d103f21f2602497d38348a32e008637d506db839"
integrity sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==
dependencies:
regenerator-runtime "^0.13.4"
@@ -143,15 +143,20 @@
"@types/minimatch" "*"
"@types/node" "*"
"@types/json-schema@^7.0.4":
version "7.0.4"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==
"@types/minimatch@*":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
"@types/node@*":
version "14.0.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.5.tgz#3d03acd3b3414cf67faf999aed11682ed121f22b"
integrity sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==
version "14.0.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.6.tgz#f9e178b2da31a4b0ec60b64649e244c31ce18daf"
integrity sha512-FbNmu4F67d3oZMWBV6Y4MaPER+0EpE9eIYf2yaHhCWovc1dlXCZkqGX4NLHfVVr6umt20TNBdRzrNJIzIKfdbw==
"@types/normalize-package-data@^2.4.0":
version "2.4.0"
@@ -185,7 +190,7 @@
dependencies:
"@vue/cli-shared-utils" "^4.4.1"
"@vue/cli-plugin-typescript@^4.3.1":
"@vue/cli-plugin-typescript@^4.4.1":
version "4.4.1"
resolved "https://registry.yarnpkg.com/@vue/cli-plugin-typescript/-/cli-plugin-typescript-4.4.1.tgz#00f2e0af3a50e00074cb01dea53ebb75bb50f392"
integrity sha512-WfgaT5N/eUlGXWsucl8vPskB3QYZFw77P1e/0TEwekVsz8yyT5/MEnZaQSH9emufcAagjpWHHL3fNQdIVg70eQ==
@@ -206,7 +211,7 @@
resolved "https://registry.yarnpkg.com/@vue/cli-plugin-vuex/-/cli-plugin-vuex-4.4.1.tgz#98d18fc5d36fa6e0d1fc2ecaeea37aa965564f19"
integrity sha512-FtOFsDP0qznwVaCz0BZmTzUm5vhHSJzX2/XD3L5dLTkrNxyDEbZmbKoX0n1OzBcQwZC7dkJZP2tdoCQx0mX//g==
"@vue/cli-service@^4.3.1":
"@vue/cli-service@^4.4.1":
version "4.4.1"
resolved "https://registry.yarnpkg.com/@vue/cli-service/-/cli-service-4.4.1.tgz#b26a435d8c953bc7efaf7b784c9835c1415bcf1c"
integrity sha512-DVV0zr5Sw7pzdm3z3PRrfqihLgoJP/d9AgNFcSSQF/J9Gtvjf1t0PTJJFeLANHSL3kDWte+3kjc22sXayu0BJQ==
@@ -527,7 +532,7 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.4.1:
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da"
integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==
ajv@^6.1.0, ajv@^6.10.2, ajv@^6.12.0, ajv@^6.5.5:
ajv@^6.1.0, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.5.5:
version "6.12.2"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd"
integrity sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==
@@ -2374,9 +2379,9 @@ ejs@^2.6.1:
integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==
electron-to-chromium@^1.3.413:
version "1.3.453"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.453.tgz#758a8565a64b7889b27132a51d2abb8b135c9d01"
integrity sha512-IQbCfjJR0NDDn/+vojTlq7fPSREcALtF8M1n01gw7nQghCtfFYrJ2dfhsp8APr8bANoFC8vRTFVXMOGpT0eetw==
version "1.3.455"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.455.tgz#fd65a3f5db6ffa83eb7c84f16ea9b1b7396f537d"
integrity sha512-4lwnxp+ArqOX9hiLwLpwhfqvwzUHFuDgLz4NTiU3lhygUzWtocIJ/5Vix+mWVNE2HQ9aI1k2ncGe5H/0OktMvA==
element-ui@^2.13.2:
version "2.13.2"
@@ -6118,11 +6123,12 @@ schema-utils@^1.0.0:
ajv-keywords "^3.1.0"
schema-utils@^2.0.0, schema-utils@^2.5.0, schema-utils@^2.6.6:
version "2.6.6"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.6.tgz#299fe6bd4a3365dc23d99fd446caff8f1d6c330c"
integrity sha512-wHutF/WPSbIi9x6ctjGGk2Hvl0VOz5l3EKEuKbjPlB30mKZUzb9A5k9yEXRX3pwyqVLPvpfZZEllaFq/M718hA==
version "2.7.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7"
integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==
dependencies:
ajv "^6.12.0"
"@types/json-schema" "^7.0.4"
ajv "^6.12.2"
ajv-keywords "^3.4.1"
scope-analyzer@^2.0.1:
@@ -6540,9 +6546,9 @@ stackblur-canvas@^2.0.0:
integrity sha512-3ZHJv+43D8YttgumssIxkfs3hBXW7XaMS5Ux65fOBhKDYMjbG5hF8Ey8a90RiiJ58aQnAhWbGilPzZ9rkIlWgQ==
stackframe@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.1.1.tgz#ffef0a3318b1b60c3b58564989aca5660729ec71"
integrity sha512-0PlYhdKh6AfFxRyK/v+6/k+/mMfyiEBbTM5L94D0ZytQnJ166wuwoTYLHFWGbs2dpA8Rgq763KGWmN1EQEYHRQ==
version "1.2.0"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.2.0.tgz#52429492d63c62eb989804c11552e3d22e779303"
integrity sha512-GrdeshiRmS1YLMYgzF16olf2jJ/IzxXY9lhKOskuVziubpTYcYqyOwYeJKzQkwy7uN0fYSsbsC4RQaXf9LCrYA==
static-eval@^2.0.5:
version "2.0.5"
@@ -7105,7 +7111,7 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^3.9.2:
typescript@^3.9.3:
version "3.9.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a"
integrity sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==
@@ -7390,10 +7396,10 @@ vue-property-decorator@^8.4.2:
dependencies:
vue-class-component "^7.1.0"
vue-router@^3.1.6:
version "3.3.1"
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.3.1.tgz#7d0545dd8ebf4f45494ca185b7eccb38d67689c1"
integrity sha512-2E2Xlks6oDzU559/NcSGD08g3XCDZznx8CK/jHIHkrbAdnCu1ghUcnz5e78SZ35gaOKtHGS01vJG8Yv4iJFTug==
vue-router@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.3.2.tgz#0099de402edb2fe92f9711053ab5a2156f239cad"
integrity sha512-5sEbcfb7MW8mY8lbUVbF4kgcipGXsagkM/X+pb6n0MhjP+RorWIUTPAPSqgPaiPOxVCXgAItBl8Vwz8vq78faA==
vue-style-loader@^4.1.0, vue-style-loader@^4.1.2:
version "4.1.2"
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.project;
import com.intellij.openapi.startup.StartupActivity;
@@ -10,7 +10,7 @@ import com.intellij.openapi.startup.StartupActivity;
* Some known implementors are:
* <li> {@link com.intellij.openapi.actionSystem.AnAction}s (see {@link com.intellij.openapi.project.DumbAwareAction})
* <li> {@link com.intellij.openapi.fileEditor.FileEditorProvider}s
* <li> post-startup activities ({@link StartupActivity} / {@link com.intellij.openapi.startup.StartupManager#registerPostStartupDumbAwareActivity(Runnable)})
* <li> post-startup activities ({@link StartupActivity})
* <li> Stacktrace {@link com.intellij.execution.filters.Filter}s
* <li> {@link com.intellij.ide.SelectInTarget}s
* <li> {@link com.intellij.ide.IconProvider}s
@@ -40,22 +40,13 @@ public abstract class StartupManager {
* Registers an activity that is performed during project load after the "Loading Project"
* progress bar is displayed. You may access the PSI structures from the activity.</p>
*
* Consider to use {@link #registerPostStartupDumbAwareActivity} if possible.
* Consider to use {@link #runAfterOpened} if possible.
*
* @param runnable the activity to execute.
* @see StartupActivity#POST_STARTUP_ACTIVITY
*/
public abstract void registerPostStartupActivity(@NotNull Runnable runnable);
/**
* Registers an {@link com.intellij.openapi.project.DumbAware} activity that is performed during project load, after the "Loading Project"
* progress bar is displayed, in a pooled thread.
*
* @param runnable the activity to execute.
* @see StartupActivity#POST_STARTUP_ACTIVITY
*/
public abstract void registerPostStartupDumbAwareActivity(@NotNull Runnable runnable);
/**
* Registers activity that is executed after project loaded.
* The runnable will be executed in current thread if project is already opened.</p>
@@ -41,7 +41,7 @@ class StartUpPerformanceReporter : StartupActivity, StartUpPerformanceService {
companion object {
internal val LOG = logger<StartUpMeasurer>()
internal const val VERSION = "21"
internal const val VERSION = "22"
internal fun sortItems(items: MutableList<ActivityImpl>) {
items.sortWith(Comparator { o1, o2 ->
@@ -12,7 +12,6 @@ import com.intellij.ide.startup.StartupManagerEx;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
@@ -87,17 +86,13 @@ public final class BuildContentManagerImpl implements BuildContentManager {
return toolWindow;
}
private void invokeLaterIfNeeded(@NotNull DumbAwareRunnable runnable) {
private void invokeLaterIfNeeded(@NotNull Runnable runnable) {
if (myProject.isDefault()) {
return;
}
if (!StartupManagerEx.getInstanceEx(myProject).startupActivityPassed()) {
StartupManagerEx.getInstanceEx(myProject).registerPostStartupDumbAwareActivity(
() -> GuiUtils.invokeLaterIfNeeded(runnable, ModalityState.defaultModalityState(), myProject.getDisposed()));
}
else {
StartupManagerEx.getInstanceEx(myProject).runAfterOpened(() -> {
GuiUtils.invokeLaterIfNeeded(runnable, ModalityState.defaultModalityState(), myProject.getDisposed());
}
});
}
@Override
@@ -255,7 +250,7 @@ public final class BuildContentManagerImpl implements BuildContentManager {
});
}
private class CloseListener extends BaseContentCloseListener {
private final class CloseListener extends BaseContentCloseListener {
private @Nullable BuildProcessHandler myProcessHandler;
private CloseListener(final @NotNull Content content, @NotNull BuildProcessHandler processHandler) {
@@ -170,7 +170,7 @@ public final class CtrlMouseHandler {
public CtrlMouseHandler(@NotNull Project project) {
myProject = project;
StartupManager.getInstance(project).registerPostStartupDumbAwareActivity(() -> {
StartupManager.getInstance(project).runAfterOpened(() -> {
EditorEventMulticaster eventMulticaster = EditorFactory.getInstance().getEventMulticaster();
eventMulticaster.addEditorMouseListener(myEditorMouseAdapter, project);
eventMulticaster.addEditorMouseMotionListener(myEditorMouseMotionListener, project);
@@ -55,7 +55,7 @@ public class ProjectLoadingErrorsNotifierImpl extends ProjectLoadingErrorsNotifi
fireNotifications();
}
else if (first) {
StartupManager.getInstance(myProject).registerPostStartupDumbAwareActivity(() -> fireNotifications());
StartupManager.getInstance(myProject).runAfterOpened(() -> fireNotifications());
}
}
@@ -1,7 +1,6 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.startup.impl;
import com.intellij.codeWithMe.ClientId;
import com.intellij.diagnostic.*;
import com.intellij.diagnostic.StartUpMeasurer.Activities;
import com.intellij.ide.IdeBundle;
@@ -24,9 +23,9 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.impl.ProjectManagerImpl;
import com.intellij.openapi.startup.StartupActivity;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.registry.Registry;
@@ -38,7 +37,9 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.nio.file.Path;
import java.util.*;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.List;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@@ -53,10 +54,8 @@ public class StartupManagerImpl extends StartupManagerEx {
private final Object myLock = new Object();
private final Deque<Runnable> myStartupActivities = new ArrayDeque<>();
private final Deque<Runnable> myDumbAwarePostStartupActivities = new ArrayDeque<>();
private final Deque<Runnable> myNotDumbAwarePostStartupActivities = new ArrayDeque<>();
private final Deque<Runnable> startupActivities = new ArrayDeque<>();
private final Deque<Runnable> postStartupActivities = new ArrayDeque<>();
private volatile boolean postStartupActivitiesPassed;
private volatile boolean myStartupActivitiesPassed;
@@ -76,31 +75,27 @@ public class StartupManagerImpl extends StartupManagerEx {
checkNonDefaultProject();
LOG.assertTrue(!myStartupActivitiesPassed, "Registering startup activity that will never be run");
synchronized (myLock) {
myStartupActivities.add(runnable);
startupActivities.add(runnable);
}
}
@Override
public void registerPostStartupActivity(@NotNull Runnable runnable) {
checkBeforeAddingPostStartupActivity();
Deque<Runnable> list = DumbService.isDumbAware(runnable) ? myDumbAwarePostStartupActivities : myNotDumbAwarePostStartupActivities;
synchronized (myLock) {
checkThatPostActivitiesNotPassed();
list.add(runnable);
}
}
@Override
public void registerPostStartupDumbAwareActivity(@NotNull Runnable runnable) {
checkBeforeAddingPostStartupActivity();
synchronized (myLock) {
myDumbAwarePostStartupActivities.add(ClientId.decorateRunnable(runnable));
}
}
private void checkBeforeAddingPostStartupActivity() {
checkNonDefaultProject();
checkThatPostActivitiesNotPassed();
Runnable effectiveRunnable;
if (DumbService.isDumbAware(runnable)) {
effectiveRunnable = runnable;
}
else {
//LOG.warn("Activities registered via registerPostStartupActivity must be dumb-aware");
effectiveRunnable = (DumbAwareRunnable)() -> DumbService.getInstance(myProject).unsafeRunWhenSmart(runnable);
}
synchronized (myLock) {
checkThatPostActivitiesNotPassed();
postStartupActivities.add(effectiveRunnable);
}
}
private void checkThatPostActivitiesNotPassed() {
@@ -126,7 +121,7 @@ public class StartupManagerImpl extends StartupManagerEx {
indicator.setText(IdeBundle.message("startup.indicator.text.running.startup.activities"));
}
doRunStartUpActivities(indicator);
runStartUpActivities(indicator);
if (indicator != null) {
indicator.checkCanceled();
@@ -145,11 +140,11 @@ public class StartupManagerImpl extends StartupManagerEx {
return future;
}
private void doRunStartUpActivities(@Nullable ProgressIndicator indicator) {
private void runStartUpActivities(@Nullable ProgressIndicator indicator) {
LOG.assertTrue(!myStartupActivitiesPassed);
Activity activity = StartUpMeasurer.startMainActivity(Activities.PROJECT_STARTUP);
runActivities(myStartupActivities, indicator, null);
Activity activity = StartUpMeasurer.startMainActivity("project startup");
runActivities(startupActivities, indicator, null);
ExtensionsAreaImpl area = (ExtensionsAreaImpl)ApplicationManager.getApplication().getExtensionArea();
executeActivitiesFromExtensionPoint(indicator, area.getExtensionPoint("com.intellij.startupActivity"));
myStartupActivitiesPassed = true;
@@ -192,7 +187,7 @@ public class StartupManagerImpl extends StartupManagerEx {
@Deprecated
public void runStartupActivities() {
if (!myStartupActivitiesPassed) {
doRunStartUpActivities(null);
runStartUpActivities(null);
}
}
@@ -226,7 +221,7 @@ public class StartupManagerImpl extends StartupManagerEx {
}
counter.incrementAndGet();
runDumbUnawareActivity(dumbService, () -> {
dumbService.unsafeRunWhenSmart(() -> {
runActivity(uiFreezeWarned, extension, pluginDescriptor, ProgressIndicatorProvider.getGlobalProgressIndicator());
dumbUnawarePostActivitiesPassed(edtActivity, counter.decrementAndGet());
});
@@ -238,6 +233,16 @@ public class StartupManagerImpl extends StartupManagerEx {
return;
}
//noinspection TestOnlyProblems
runPostStartupActivitiesRegisteredDynamically();
dumbAwareActivity.end();
snapshot.logResponsivenessSinceCreation("Post-startup activities under progress");
if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode()) {
scheduleBackgroundPostStartupActivities();
}
StartupActivity.POST_STARTUP_ACTIVITY.addExtensionPointListener(new ExtensionPointListener<StartupActivity>() {
@Override
public void extensionAdded(@NotNull StartupActivity extension, @NotNull PluginDescriptor pluginDescriptor) {
@@ -245,18 +250,12 @@ public class StartupManagerImpl extends StartupManagerEx {
runActivity(new AtomicBoolean(), extension, pluginDescriptor, ProgressIndicatorProvider.getGlobalProgressIndicator());
}
else {
runDumbUnawareActivity(DumbService.getInstance(myProject), () -> {
DumbService.getInstance(myProject).unsafeRunWhenSmart(() -> {
runActivity(null, extension, pluginDescriptor, ProgressIndicatorProvider.getGlobalProgressIndicator());
});
}
}
}, myProject);
runActivities(myDumbAwarePostStartupActivities, null, null);
dumbAwareActivity.end();
snapshot.logResponsivenessSinceCreation("Post-startup activities under progress");
runDumbUnawarePostStartupActivitiesRegisteredDynamically();
}
private static void dumbUnawarePostActivitiesPassed(@NotNull AtomicReference<Activity> edtActivity, int count) {
@@ -315,62 +314,36 @@ public class StartupManagerImpl extends StartupManagerEx {
return;
}
runActivities(myDumbAwarePostStartupActivities, null, Activities.PROJECT_DUMB_POST_STARTUP);
runDumbUnawarePostStartupActivitiesRegisteredDynamically();
}
runActivities(postStartupActivities, null, "project post-startup");
private void runDumbUnawarePostStartupActivitiesRegisteredDynamically() {
DumbService dumbService = DumbService.getInstance(myProject);
runDumbUnawareActivity(dumbService, new Runnable() {
DumbService.getInstance(myProject).unsafeRunWhenSmart(new Runnable() {
@Override
public void run() {
// myDumbAwarePostStartupActivities might be non-empty if new activities were registered during dumb mode
// todo should it be moved out of EDT? Not clear, do we really have a lot of such activities
runActivities(myDumbAwarePostStartupActivities, null, Activities.PROJECT_DUMB_POST_STARTUP);
while (true) {
List<Runnable> dumbUnaware = takeDumbUnawareStartupActivities();
if (dumbUnaware.isEmpty()) {
break;
}
// queue each activity in smart mode separately so that if one of them starts the dumb mode, the next ones just wait for it to finish
for (Runnable activity : dumbUnaware) {
runDumbUnawareActivity(dumbService, () -> runActivity(activity));
synchronized (myLock) {
if (postStartupActivities.isEmpty()) {
postStartupActivitiesPassed = true;
return;
}
}
runActivities(postStartupActivities, null, null);
DumbService dumbService = DumbService.getInstance(myProject);
if (dumbService.isDumb()) {
// return here later to process newly submitted activities (if any) and set myPostStartupActivitiesPassed
DumbService.getInstance(myProject).unsafeRunWhenSmart(this);
// return here later to process newly submitted activities (if any) and set postStartupActivitiesPassed
dumbService.unsafeRunWhenSmart(this);
}
else {
postStartupActivitiesPassed = true;
}
}
});
//noinspection TestOnlyProblems
if (!myProject.isDisposed() && !ProjectManagerImpl.isLight(myProject)) {
scheduleBackgroundPostStartupActivities();
}
}
private @NotNull List<Runnable> takeDumbUnawareStartupActivities() {
synchronized (myLock) {
if (myNotDumbAwarePostStartupActivities.isEmpty()) {
return Collections.emptyList();
}
List<Runnable> result = new ArrayList<>(myNotDumbAwarePostStartupActivities);
myNotDumbAwarePostStartupActivities.clear();
return result;
}
}
private void runActivities(@NotNull Deque<? extends Runnable> activities, @Nullable ProgressIndicator indicator, @Nullable String activityName) {
if (activities.isEmpty()) {
return;
synchronized (myLock) {
if (activities.isEmpty()) {
return;
}
}
Activity activity = activityName == null ? null : StartUpMeasurer.startMainActivity(activityName);
@@ -407,10 +380,6 @@ public class StartupManagerImpl extends StartupManagerEx {
}
private void scheduleBackgroundPostStartupActivities() {
if (myProject.isDisposed() || ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
ScheduledFuture<?> scheduledFuture = AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> {
if (myProject.isDisposed()) {
return;
@@ -469,12 +438,12 @@ public class StartupManagerImpl extends StartupManagerEx {
return;
}
registerPostStartupDumbAwareActivity(() -> {
runAfterOpened(() -> {
if (DumbService.isDumbAware(action)) {
runActivity(action);
}
else {
runDumbUnawareActivity(DumbService.getInstance(myProject), action);
DumbService.getInstance(myProject).unsafeRunWhenSmart(action);
}
});
}, ModalityState.NON_MODAL, myProject.getDisposed());
@@ -487,7 +456,7 @@ public class StartupManagerImpl extends StartupManagerEx {
if (!postStartupActivitiesPassed) {
synchronized (myLock) {
if (!postStartupActivitiesPassed) {
myDumbAwarePostStartupActivities.add(runnable);
postStartupActivities.add(runnable);
return;
}
}
@@ -496,18 +465,11 @@ public class StartupManagerImpl extends StartupManagerEx {
runnable.run();
}
private void runDumbUnawareActivity(@NotNull DumbService dumbService, @NotNull Runnable action) {
GuiUtils.invokeLaterIfNeeded(() -> {
dumbService.unsafeRunWhenSmart(action);
}, ModalityState.NON_MODAL, myProject.getDisposed());
}
@TestOnly
public synchronized void prepareForNextTest() {
synchronized (myLock) {
myStartupActivities.clear();
myDumbAwarePostStartupActivities.clear();
myNotDumbAwarePostStartupActivities.clear();
startupActivities.clear();
postStartupActivities.clear();
}
}
@@ -515,9 +477,8 @@ public class StartupManagerImpl extends StartupManagerEx {
public synchronized void checkCleared() {
try {
synchronized (myLock) {
assert myStartupActivities.isEmpty() : "Activities: " + myStartupActivities;
assert myDumbAwarePostStartupActivities.isEmpty() : "DumbAware Post Activities: " + myDumbAwarePostStartupActivities;
assert myNotDumbAwarePostStartupActivities.isEmpty() : "Post Activities: " + myNotDumbAwarePostStartupActivities;
assert startupActivities.isEmpty() : "Activities: " + startupActivities;
assert postStartupActivities.isEmpty() : "DumbAware Post Activities: " + postStartupActivities;
}
}
finally {
@@ -1403,7 +1403,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
// extends/cuts number of opened tabs. Also updates location of tabs
connection.subscribe(UISettingsListener.TOPIC, new MyUISettingsListener());
StartupManager.getInstance(myProject).registerPostStartupDumbAwareActivity(() -> {
StartupManager.getInstance(myProject).runAfterOpened(() -> {
if (myProject.isDisposed()) {
return;
}
@@ -216,7 +216,13 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
}
}
runnable.run();
Application app = ApplicationManager.getApplication();
if (app.isDispatchThread()) {
runnable.run();
}
else {
app.invokeLater(() -> unsafeRunWhenSmart(runnable), ModalityState.NON_MODAL, myProject.getDisposed());
}
}
@Override
@@ -1,7 +1,6 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.project;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.progress.ProcessCanceledException;
@@ -34,7 +33,7 @@ final class TrackedEdtActivityService {
}
}
void invokeLater(@NotNull Runnable action) {
private void invokeLater(@NotNull Runnable action) {
new TrackedEdtActivity(action).invokeLater();
}
@@ -90,10 +89,8 @@ final class TrackedEdtActivityService {
}
void invokeLaterAfterProjectInitialized() {
StartupManager startupManager = StartupManager.getInstance(myProject);
startupManager.runWhenProjectIsInitialized((DumbAwareRunnable)() -> {
Application app = ApplicationManager.getApplication();
app.invokeLater(this, myDumbStartModality, getProjectActivityExpirationCondition());
StartupManager.getInstance(myProject).runWhenProjectIsInitialized((DumbAwareRunnable)() -> {
ApplicationManager.getApplication().invokeLater(this, myDumbStartModality, getProjectActivityExpirationCondition());
});
}
@@ -373,7 +373,7 @@ private fun checkExistingProjectOnOpen(projectToClose: Project, callback: Projec
}
private fun openFileFromCommandLine(project: Project, file: Path, line: Int, column: Int) {
StartupManager.getInstance(project).registerPostStartupDumbAwareActivity {
StartupManager.getInstance(project).runAfterOpened {
ApplicationManager.getApplication().invokeLater(Runnable {
if (project.isDisposed || !Files.exists(file)) {
return@Runnable
@@ -2,16 +2,13 @@
package com.intellij.ide
import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.openapi.project.DumbAwareRunnable
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.DumbServiceImpl
import com.intellij.openapi.project.ex.ProjectManagerEx
import com.intellij.testFramework.ApplicationRule
import com.intellij.testFramework.PlatformTestUtil
import com.intellij.openapi.startup.StartupActivity
import com.intellij.testFramework.*
import com.intellij.testFramework.assertions.Assertions.assertThat
import com.intellij.testFramework.createHeavyProject
import com.intellij.testFramework.rules.InMemoryFsRule
import com.intellij.testFramework.runInEdtAndWait
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
@@ -38,23 +35,23 @@ class StartupManagerTest {
val startupManager = StartupManagerImpl.getInstance(project) as StartupManagerImpl
assertThat(startupManager.postStartupActivityPassed()).isFalse()
val done = CountDownLatch(1)
val dumbService = DumbService.getInstance(project) as DumbServiceImpl
startupManager.registerPostStartupActivity(DumbAwareRunnable {
ExtensionTestUtil.maskExtensions(StartupActivity.POST_STARTUP_ACTIVITY, listOf(StartupActivity.DumbAware {
runInEdtAndWait {
dumbService.isDumb = true
}
assertThat(dumbService.isDumb).isTrue()
})
}, StartupActivity.DumbAware {
startupManager.runAfterOpened {
assertThat(dumbService.isDumb).isTrue()
done.countDown()
}
}), project, fireEvents = false)
assertThat(startupManager.postStartupActivityPassed()).isFalse()
ProjectManagerEx.getInstanceEx().openProject(project)
val done = CountDownLatch(1)
startupManager.runAfterOpened {
assertThat(dumbService.isDumb).isTrue()
done.countDown()
}
done.await(1, TimeUnit.SECONDS)
}
finally {
@@ -34,8 +34,6 @@ import com.intellij.find.impl.FindManagerImpl;
import com.intellij.ide.IdeEventQueue;
import com.intellij.ide.actions.searcheverywhere.ClassSearchEverywhereContributor;
import com.intellij.ide.actions.searcheverywhere.SearchEverywhereContributor;
import com.intellij.ide.startup.StartupManagerEx;
import com.intellij.ide.startup.impl.StartupManagerImpl;
import com.intellij.ide.structureView.StructureViewBuilder;
import com.intellij.ide.structureView.newStructureView.StructureViewComponent;
import com.intellij.ide.util.scopeChooser.ScopeDescriptor;
@@ -1198,7 +1196,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(false);
ensureIndexesUpToDate(getProject());
((StartupManagerImpl)StartupManagerEx.getInstanceEx(getProject())).runPostStartupActivitiesRegisteredDynamically();
CodeStyle.setTemporarySettings(getProject(), CodeStyle.createTestSettings());
IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current();
@@ -30,9 +30,6 @@ public final class StartUpMeasurer {
public static final String REGISTER_COMPONENTS_SUFFIX = "component registration";
public static final String CREATE_COMPONENTS_SUFFIX = "component creation";
public static final String PROJECT_STARTUP = "project startup";
public static final String PROJECT_DUMB_POST_STARTUP = "project dumb post-startup";
public static final String PROJECT_DUMB_POST_START_UP_ACTIVITIES = "project post-startup dumb-aware activities";
public static final String EDITOR_RESTORING = "editor restoring";
public static final String EDITOR_RESTORING_TILL_PAINT = "editor restoring till paint";
@@ -86,10 +86,7 @@ public final class FileStatusManagerImpl extends FileStatusManager implements Di
projectBus.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, this::fileStatusesChanged);
if (!project.isDefault()) {
StartupManager startManager = StartupManager.getInstance(project);
if (!startManager.postStartupActivityPassed()) {
startManager.registerPostStartupDumbAwareActivity(this::fileStatusesChanged);
}
StartupManager.getInstance(project).runAfterOpened(this::fileStatusesChanged);
}
FileStatusProvider.EP_NAME.addChangeListener(myProject, this::fileStatusesChanged, project);
@@ -2,14 +2,12 @@
package org.jetbrains.idea.svn;
import com.intellij.execution.process.ProcessOutput;
import com.intellij.ide.startup.impl.StartupManagerImpl;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.command.undo.UndoManager;
import com.intellij.openapi.progress.EmptyProgressIndicator;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.TestDialog;
import com.intellij.openapi.util.SystemInfo;
@@ -135,7 +133,6 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
vcs = SvnVcs.getInstance(myProject);
myGate = new MockChangeListManagerGate(changeListManager);
((StartupManagerImpl)StartupManager.getInstance(myProject)).runPostStartupActivitiesRegisteredDynamically();
refreshSvnMappingsSynchronously();
refreshChanges();
}
@@ -374,7 +371,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
});
}
protected void withDisabledChangeListManager(@NotNull ThrowableRunnable<? extends Exception> action) throws Exception {
private void withDisabledChangeListManager(@NotNull ThrowableRunnable<? extends Exception> action) throws Exception {
changeListManager.waitUntilRefreshed();
changeListManager.forceStopInTestMode();
action.run();
@@ -387,7 +384,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
return new VcsDirectoryMapping(toSystemIndependentName(directory.getPath()), vcs.getName());
}
protected void createAnotherRepo() throws Exception {
private void createAnotherRepo() throws Exception {
File repo = virtualToIoFile(myTempDirFixture.findOrCreateDir("anotherRepo"));
copyDir(myRepoRoot, repo);
myAnotherRepoUrl = (SystemInfo.isWindows ? "file:///" : "file://") + toSystemIndependentName(repo.getPath());
@@ -467,8 +464,8 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
runAndVerifyAcrossLocks(workingDir, myRunner, input, verifier, primitiveVerifier);
}
public static void runAndVerifyAcrossLocks(File workingDir, final TestClientRunner runner, final String[] input,
final Processor<ProcessOutput> verifier, final Processor<ProcessOutput> primitiveVerifier) throws IOException {
private static void runAndVerifyAcrossLocks(File workingDir, final TestClientRunner runner, final String[] input,
final Processor<ProcessOutput> verifier, final Processor<ProcessOutput> primitiveVerifier) throws IOException {
for (int i = 0; i < 5; i++) {
final ProcessOutput output = runner.runClient("svn", null, workingDir, input);
if (output.getExitCode() != 0 && !isEmptyOrSpaces(output.getStderr())) {