protected void OnDataAddedOrChanged(object key, int itemCount)
            {
                // reuse factory. it is okay to re-use factory since we make sure we remove the factory before
                // adding it back
                bool newFactory = false;
                ImmutableArray <SubscriptionWithoutLock>     snapshot;
                AbstractTableEntriesFactory <DiagnosticData> factory;

                lock (Gate)
                {
                    snapshot = Subscriptions;
                    if (!Map.TryGetValue(key, out factory))
                    {
                        factory = new TableEntriesFactory(this, _workspace);
                        Map.Add(key, factory);
                        newFactory = true;
                    }
                }

                factory.OnUpdated(itemCount);

                for (var i = 0; i < snapshot.Length; i++)
                {
                    snapshot[i].AddOrUpdate(factory, newFactory);
                }
            }
Exemple #2
0
 public TableEntriesSnapshot(
     TableEntriesFactory factory, int version,
     int projectRank, ImmutableArray <DiagnosticData> items, ImmutableArray <ITrackingPoint> trackingPoints) :
     base(version, items, trackingPoints)
 {
     _projectRank = projectRank;
     _factory     = factory;
 }
Exemple #3
0
        public void Refresh(TableEntriesFactory <TItem> factory)
        {
            var snapshot = _subscriptions;

            for (var i = 0; i < snapshot.Length; i++)
            {
                snapshot[i].AddOrUpdate(factory, newFactory: false);
            }
        }
        private void GetOrCreateFactory_NoLock(object data, out TableEntriesFactory <TData> factory, out bool newFactory)
        {
            newFactory = false;

            var key = GetOrUpdateAggregationKey(data);

            if (_map.TryGetValue(key, out factory))
            {
                return;
            }

            var source = CreateTableEntriesSource(data);

            factory = new TableEntriesFactory <TData>(this, source);

            _map.Add(key, factory);
            newFactory = true;
        }
 public TableEntriesSnapshot(
     TableEntriesFactory factory, int version, ImmutableArray <DiagnosticData> items) :
     base(version, Guid.Empty, items, ImmutableArray <ITrackingPoint> .Empty)
 {
     _factory = factory;
 }
 public TableEntriesSnapshot(
     TableEntriesFactory factory, int version, ImmutableArray <TodoTaskItem> items, ImmutableArray <ITrackingPoint> trackingPoints) :
     base(version, GetProjectGuid(factory._workspace, factory._documentId.ProjectId), items, trackingPoints)
 {
     _factory = factory;
 }
 public TableEntriesSnapshot(
     TableEntriesFactory factory, int version, ImmutableArray <DiagnosticData> items, ImmutableArray <ITrackingPoint> trackingPoints) :
     base(version, GetProjectGuid(factory._workspace, factory._projectId), items, trackingPoints)
 {
     _factory = factory;
 }
 public TableEntriesSnapshot(
     TableEntriesFactory factory, int version, ImmutableArray <TodoTaskItem> items, ImmutableArray <ITrackingPoint> trackingPoints) :
     base(version, items, trackingPoints)
 {
     _factory = factory;
 }
 private static void NotifySubscriptionOnDataRemoved_NoLock(ImmutableArray <SubscriptionWithoutLock> snapshot, TableEntriesFactory <TData> factory)
 {
     for (var i = 0; i < snapshot.Length; i++)
     {
         snapshot[i].Remove(factory);
     }
 }
 private static void NotifySubscriptionOnDataAddedOrChanged_NoLock(ImmutableArray <SubscriptionWithoutLock> snapshot, TableEntriesFactory <TData> factory, bool newFactory)
 {
     for (var i = 0; i < snapshot.Length; i++)
     {
         snapshot[i].AddOrUpdate(factory, newFactory);
     }
 }