Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sellophane committed Jan 17, 2025
1 parent e54a416 commit ca80922
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/src/com/google/idea/blaze/base/qsync/ProjectUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ public void onNewProjectSnapshot(Context<?> context, QuerySyncProjectSnapshot gr

private void updateProjectModel(ProjectProto.Project spec, Context<?> context) {
File imlDirectory = new File(BlazeDataStorage.getProjectDataDir(importSettings), "modules");
ProjectUpdaterThreadingUtils.Companion.performWriteAction(() -> {
ProjectUpdaterThreadingUtils.performWriteAction(() -> {
for (BlazeQuerySyncPlugin syncPlugin : BlazeQuerySyncPlugin.EP_NAME.getExtensions()) {
syncPlugin.updateProjectSettingsForQuerySync(project, context, projectViewSet);
}
});
ProjectUpdaterThreadingUtils.Companion.readWriteAction(
ProjectUpdaterThreadingUtils.readWriteAction(
() -> {
IdeModifiableModelsProvider models =
ProjectDataManager.getInstance().createModifiableModelsProvider(project);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2025 The Bazel Authors. All rights reserved.
*
* 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.
*/
package com.google.idea.blaze.base.qsync

import com.intellij.openapi.application.readAndWriteAction
Expand All @@ -10,6 +25,8 @@ import java.util.function.Consumer
class ProjectUpdaterThreadingUtils {
companion object {
val logger = Logger.getInstance(ProjectUpdaterThreadingUtils::class.java)

@JvmStatic
fun <T> readWriteAction(readPart: Callable<T>, commit: Consumer<T>) {
runBlocking {
readAndWriteAction {
Expand All @@ -22,6 +39,7 @@ class ProjectUpdaterThreadingUtils {
}
}

@JvmStatic
fun performWriteAction(action: Runnable) {
runBlocking {
writeAction<Unit> {
Expand Down

0 comments on commit ca80922

Please sign in to comment.