private VirtualMemoryNotificationListener(
            SVsServiceProvider serviceProvider,
            VisualStudioWorkspace workspace) : base(assertIsForeground: true)
        {
            _workspace = workspace;
            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            _workspaceCacheService = workspace.Services.GetService<IWorkspaceCacheService>() as WorkspaceCacheService;

            var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
            // Note: We never unhook this event sink. It lives for the lifetime of the host.
            ErrorHandler.ThrowOnFailure(shell.AdviseBroadcastMessages(this, out var cookie));
        }
예제 #2
0
        private VirtualMemoryNotificationListener(
            SVsServiceProvider serviceProvider,
            VisualStudioWorkspace workspace) : base(assertIsForeground: true)
        {
            _workspace = workspace;
            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            _workspaceCacheService = workspace.Services.GetService <IWorkspaceCacheService>() as WorkspaceCacheService;

            var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));

            // Note: We never unhook this event sink. It lives for the lifetime of the host.
            ErrorHandler.ThrowOnFailure(shell.AdviseBroadcastMessages(this, out var cookie));
        }
예제 #3
0
        public VirtualMemoryNotificationListener(
            IThreadingContext threadingContext,
            SVsServiceProvider serviceProvider,
            VisualStudioWorkspace workspace)
            : base(threadingContext, assertIsForeground: true)
        {
            _workspace             = workspace;
            _workspaceCacheService = workspace.Services.GetService <IWorkspaceCacheService>() as WorkspaceCacheService;

            if (GCSettings.IsServerGC)
            {
                // Server GC has been explicitly enabled, which tends to run with higher memory pressure than the
                // default workstation GC. Allow this case without triggering frequent feature shutdown.
                return;
            }

            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));

            // Note: We never unhook this event sink. It lives for the lifetime of the host.
            ErrorHandler.ThrowOnFailure(shell.AdviseBroadcastMessages(this, out var cookie));
        }