Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache to viewdescriptorservice #88656

Merged
merged 12 commits into from
Jan 16, 2020
Merged

Conversation

sbatten
Copy link
Member

@sbatten sbatten commented Jan 15, 2020

refs #85164

@sbatten sbatten requested a review from sandy081 January 15, 2020 05:10
@sbatten sbatten self-assigned this Jan 15, 2020
@sbatten sbatten added this to the January 2020 milestone Jan 15, 2020
@sbatten sbatten requested a review from isidorn January 15, 2020 05:11
@sandy081
Copy link
Member

@sbatten Not sure why this looks bit complicated. I am guessing the implementation as follows:

  • Create a IViewDescriptorsCollection for a given container using the location information from ViewDescriptorsRegistry and Storage (cache).
  • You primary source for view descriptors should be ViewDescriptorsRegistry. Listen to ViewDescriptorsRegistry and update view descriptors of IViewDescriptorsCollection based on the location information.

Let me know if I am missing anything else here?

@sandy081
Copy link
Member

@sbatten

I think we can do a bit of clean up without your changes and after that your changes can become more simpler. for eg: try removing the events onViewsRegistered and onViewsDeregistered from the service. These events are only used inside the service.


this.onDidChangeActiveViews({ added: viewDescriptorCollection.activeViewDescriptors, removed: [] });
viewDescriptorCollection.onDidChangeActiveViews(changed => this.onDidChangeActiveViews(changed), this, disposables);

this.viewDescriptorCollections.set(viewContainer, { viewDescriptorCollection, disposable: disposables });

// Check if we have any views that were awaiting container registration due to a cached position
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks this comment is outdated

const disposables = new DisposableStore();
const viewDescriptorCollection = disposables.add(new ViewDescriptorCollection(this.contextKeyService));
viewDescriptorCollection.addViews(this.viewsRegistry.getViews(viewContainer));
private getViewContainerById(id: string): ViewContainer | undefined {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method does not exist on view container registry? If does not, lets please create one there and use it.

this.deregisterGroupedViews(regroupedViews);
}

private regroupViews(containerId: string, views: IViewDescriptor[], seedMap?: Map<string, IViewDescriptor[]>): Map<string, IViewDescriptor[]> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see seedMap is passed any where. So this arg is not needed.

@sandy081
Copy link
Member

LGTM. Provided some feedback.

@sbatten
Copy link
Member Author

sbatten commented Jan 16, 2020

will update and merge thanks

@sbatten sbatten merged commit dba8d71 into microsoft:master Jan 16, 2020
@sbatten sbatten deleted the reloadViewCache branch January 16, 2020 18:05
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants