public LowPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        Lazy<ImmutableArray<IIncrementalAnalyzer>> lazyAnalyzers,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, processor, lazyAnalyzers, globalOperationNotificationService, backOffTimeSpanInMs, shutdownToken)
                    {
                        _workItemQueue = new AsyncProjectWorkItemQueue(processor._registration.ProgressReporter, processor._registration.Workspace);

                        Start();
                    }
                    public AbstractPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, globalOperationNotificationService, backOffTimeSpanInMs, shutdownToken)
                    {
                        this.Processor = processor;

                        if (this.Processor._documentTracker != null)
                        {
                            this.Processor._documentTracker.NonRoslynBufferTextChanged += OnNonRoslynBufferTextChanged;
                        }
                    }
                    public GlobalOperationAwareIdleProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, backOffTimeSpanInMs, shutdownToken)
                    {
                        this.Processor = processor;
                        _globalOperation = null;
                        _globalOperationTask = SpecializedTasks.EmptyTask;

                        _globalOperationNotificationService = globalOperationNotificationService;
                        _globalOperationNotificationService.Started += OnGlobalOperationStarted;
                        _globalOperationNotificationService.Stopped += OnGlobalOperationStopped;
                    }
                    public HighPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        Lazy<ImmutableArray<IIncrementalAnalyzer>> lazyAnalyzers,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, backOffTimeSpanInMs, shutdownToken)
                    {
                        _processor = processor;
                        _lazyAnalyzers = lazyAnalyzers;

                        _running = SpecializedTasks.EmptyTask;
                        _workItemQueue = new AsyncDocumentWorkItemQueue(processor._registration.ProgressReporter, processor._registration.Workspace);

                        Start();
                    }
Beispiel #5
0
            public WorkCoordinator(
                IAsynchronousOperationListener listener,
                IEnumerable <Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata> > analyzerProviders,
                bool initializeLazily,
                Registration registration)
            {
                _logAggregator = new LogAggregator();

                _registration = registration;

                _listener      = listener;
                _optionService = _registration.GetService <IOptionService>();

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS          = _optionService.GetOption(InternalSolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS      = _optionService.GetOption(InternalSolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);

                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, analyzerProviders, initializeLazily, _registration,
                    activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS  = _optionService.GetOption(InternalSolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, _registration, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(InternalSolutionCrawlerOptions.SolutionCrawler))
                {
                    _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _registration.Workspace.DocumentOpened   += OnDocumentOpened;
                    _registration.Workspace.DocumentClosed   += OnDocumentClosed;
                }

                // subscribe to option changed event after all required fields are set
                // otherwise, we can get null exception when running OnOptionChanged handler
                _optionService.OptionChanged += OnOptionChanged;
            }
Beispiel #6
0
                    public AbstractPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        Lazy <ImmutableArray <IIncrementalAnalyzer> > lazyAnalyzers,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, globalOperationNotificationService, backOffTimeSpanInMs, shutdownToken)
                    {
                        _gate          = new object();
                        _lazyAnalyzers = lazyAnalyzers;

                        this.Processor = processor;

                        if (this.Processor._documentTracker != null)
                        {
                            this.Processor._documentTracker.NonRoslynBufferTextChanged += OnNonRoslynBufferTextChanged;
                        }
                    }
Beispiel #7
0
            public WorkCoordinator(
                 IAsynchronousOperationListener listener,
                 IEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>> analyzerProviders,
                 Registration registration)
            {
                _logAggregator = new LogAggregator();

                _registration = registration;

                _listener = listener;
                _optionService = _registration.GetService<IOptionService>();

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);

                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, analyzerProviders, _registration,
                    activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, _registration, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(InternalSolutionCrawlerOptions.SolutionCrawler))
                {
                    _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _registration.Workspace.DocumentOpened += OnDocumentOpened;
                    _registration.Workspace.DocumentClosed += OnDocumentClosed;
                }

                // subscribe to option changed event after all required fields are set
                // otherwise, we can get null exception when running OnOptionChanged handler
                _optionService.OptionChanged += OnOptionChanged;
            }
Beispiel #8
0
                public SemanticChangeProcessor(
                    IAsynchronousOperationListener listener,
                    Registration registration,
                    IncrementalAnalyzerProcessor documentWorkerProcessor,
                    int backOffTimeSpanInMS,
                    int projectBackOffTimeSpanInMS,
                    CancellationToken cancellationToken) :
                    base(listener, backOffTimeSpanInMS, cancellationToken)
                {
                    _gate = new AsyncSemaphore(initialCount: 0);

                    _registration = registration;

                    _processor = new ProjectProcessor(listener, registration, documentWorkerProcessor, projectBackOffTimeSpanInMS, cancellationToken);

                    _workGate    = new NonReentrantLock();
                    _pendingWork = new Dictionary <DocumentId, Data>();

                    Start();
                }
                    public NormalPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        Lazy<ImmutableArray<IIncrementalAnalyzer>> lazyAnalyzers,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, processor, lazyAnalyzers, globalOperationNotificationService, backOffTimeSpanInMs, shutdownToken)
                    {
                        _running = SpecializedTasks.EmptyTask;
                        _workItemQueue = new AsyncDocumentWorkItemQueue(processor._registration.ProgressReporter, processor._registration.Workspace);
                        _higherPriorityDocumentsNotProcessed = new ConcurrentDictionary<DocumentId, IDisposable>(concurrencyLevel: 2, capacity: 20);

                        _currentProjectProcessing = default(ProjectId);
                        _processingSolution = null;

                        _currentSnapshotVersionTrackingSet = new HashSet<ProjectId>();

                        Start();
                    }
Beispiel #10
0
                    public HighPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        Lazy <ImmutableArray <IIncrementalAnalyzer> > lazyAnalyzers,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken
                        ) : base(listener, backOffTimeSpanInMs, shutdownToken)
                    {
                        _processor     = processor;
                        _lazyAnalyzers = lazyAnalyzers;
                        _gate          = new object();

                        _running       = Task.CompletedTask;
                        _workItemQueue = new AsyncDocumentWorkItemQueue(
                            processor._registration.ProgressReporter,
                            processor._registration.Workspace
                            );

                        Start();
                    }
                    public NormalPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        Lazy <ImmutableArray <IIncrementalAnalyzer> > lazyAnalyzers,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, processor, lazyAnalyzers, globalOperationNotificationService, backOffTimeSpanInMs, shutdownToken)
                    {
                        _running       = SpecializedTasks.EmptyTask;
                        _workItemQueue = new AsyncDocumentWorkItemQueue(processor._registration.ProgressReporter, processor._registration.Workspace);
                        _higherPriorityDocumentsNotProcessed = new ConcurrentDictionary <DocumentId, IDisposable>(concurrencyLevel: 2, capacity: 20);

                        _currentProjectProcessing = default(ProjectId);
                        _processingSolution       = null;

                        _currentSnapshotVersionTrackingSet = new HashSet <ProjectId>();

                        Start();
                    }
Beispiel #12
0
            public WorkCoordinator(
                IAsynchronousOperationListener listener,
                IEnumerable <Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata> > analyzerProviders,
                int correlationId, Workspace workspace)
            {
                _logAggregator = new LogAggregator();

                _listener      = listener;
                _optionService = workspace.Services.GetService <IOptionService>();
                _optionService.OptionChanged += OnOptionChanged;

                // set up workspace
                _correlationId = correlationId;
                _workspace     = workspace;

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS          = _optionService.GetOption(SolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS      = _optionService.GetOption(SolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);

                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, correlationId, workspace, analyzerProviders, activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS  = _optionService.GetOption(SolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, correlationId, workspace, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(SolutionCrawlerOptions.SolutionCrawler))
                {
                    _workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _workspace.DocumentOpened   += OnDocumentOpened;
                    _workspace.DocumentClosed   += OnDocumentClosed;
                }
            }
                    public ProjectProcessor(
                        IAsynchronousOperationListener listener,
                        int correlationId,
                        Workspace workspace,
                        IncrementalAnalyzerProcessor processor,
                        int backOffTimeSpanInMS,
                        CancellationToken cancellationToken) :
                        base(listener, backOffTimeSpanInMS, cancellationToken)
                    {
                        this.correlationId = correlationId;

                        this.workspace = workspace;
                        this.processor = processor;

                        this.gate = new AsyncSemaphore(initialCount: 0);

                        this.workGate    = new NonReentrantLock();
                        this.pendingWork = new Dictionary <ProjectId, Data>();

                        Start();
                    }
Beispiel #14
0
            public WorkCoordinator(
                 IAsynchronousOperationListener listener,
                 IEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>> analyzerProviders,
                 int correlationId, Workspace workspace)
            {
                _logAggregator = new LogAggregator();

                _listener = listener;
                _optionService = workspace.Services.GetService<IOptionService>();
                _optionService.OptionChanged += OnOptionChanged;

                // set up workspace 
                _correlationId = correlationId;
                _workspace = workspace;

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);
                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, correlationId, workspace, analyzerProviders, activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, correlationId, workspace, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(SolutionCrawlerOptions.SolutionCrawler))
                {
                    _workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _workspace.DocumentOpened += OnDocumentOpened;
                    _workspace.DocumentClosed += OnDocumentClosed;
                }
            }
                    public GlobalOperationAwareIdleProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken) :
                        base(listener, backOffTimeSpanInMs, shutdownToken)
                    {
                        this.Processor = processor;

                        _globalOperation     = null;
                        _globalOperationTask = SpecializedTasks.EmptyTask;

                        _globalOperationNotificationService          = globalOperationNotificationService;
                        _globalOperationNotificationService.Started += OnGlobalOperationStarted;
                        _globalOperationNotificationService.Stopped += OnGlobalOperationStopped;

                        if (this.Processor._documentTracker != null)
                        {
                            this.Processor._documentTracker.NonRoslynBufferTextChanged += OnNonRoslynBufferTextChanged;
                        }
                    }
                    public LowPriorityProcessor(
                        IAsynchronousOperationListener listener,
                        IncrementalAnalyzerProcessor processor,
                        Lazy <ImmutableArray <IIncrementalAnalyzer> > lazyAnalyzers,
                        IGlobalOperationNotificationService globalOperationNotificationService,
                        int backOffTimeSpanInMs,
                        CancellationToken shutdownToken
                        )
                        : base(
                            listener,
                            processor,
                            lazyAnalyzers,
                            globalOperationNotificationService,
                            backOffTimeSpanInMs,
                            shutdownToken
                            )
                    {
                        _workItemQueue = new AsyncProjectWorkItemQueue(
                            processor._registration.ProgressReporter,
                            processor._registration.Workspace
                            );

                        Start();
                    }
Beispiel #17
0
 internal TestAccessor(IncrementalAnalyzerProcessor incrementalAnalyzerProcessor)
 {
     _incrementalAnalyzerProcessor = incrementalAnalyzerProcessor;
 }