public override Present Realize(string refCredit)
		{
			Monitor.Enter(this);
			Present result;
			try
			{
				if (this.activeAsyncRef != null)
				{
					result = this.activeAsyncRef.Duplicate(refCredit);
				}
				else
				{
					D.Assert(!this.realizing);
					this.realizing = true;
					this.activeAsyncRef = (AsyncRef)this.future.Realize("ODSPF");
					AsyncRef asyncRef = (AsyncRef)this.activeAsyncRef.Duplicate(refCredit);
					this.prioritizer.Realizing(this);
					this.activeAsyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.AsyncCompleteCallback));
					result = asyncRef;
				}
			}
			finally
			{
				Monitor.Exit(this);
			}
			return result;
		}
Пример #2
0
		public PersistentInterest(AsyncRef asyncRef)
		{
			this.interestList = new InterestList();
			this.interestList.Add(asyncRef);
			this.interestList.Activate();
			asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.AsyncCompleteCallback));
		}
Пример #3
0
 public PersistentInterest(AsyncRef asyncRef)
 {
     this.interestList = new InterestList();
     this.interestList.Add(asyncRef);
     this.interestList.Activate();
     asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.AsyncCompleteCallback));
 }
        public override Present Realize(string refCredit)
        {
            Monitor.Enter(this);
            Present result;

            try
            {
                if (activeAsyncRef != null)
                {
                    result = activeAsyncRef.Duplicate(refCredit);
                }
                else
                {
                    D.Assert(!realizing);
                    realizing      = true;
                    activeAsyncRef = (AsyncRef)future.Realize("ODSPF");
                    AsyncRef asyncRef = (AsyncRef)activeAsyncRef.Duplicate(refCredit);
                    prioritizer.Realizing(this);
                    activeAsyncRef.AddCallback(AsyncCompleteCallback);
                    result = asyncRef;
                }
            }
            finally
            {
                Monitor.Exit(this);
            }

            return(result);
        }
		private void RendererSanityCheckComplete(AsyncRef asyncRef)
		{
			Monitor.Enter(this);
			try
			{
				if (this.handled)
				{
					return;
				}
				this.handled = true;
			}
			finally
			{
				Monitor.Exit(this);
			}
			if (!(asyncRef.present is ImageRef))
			{
				if (asyncRef.present is RequestCanceledPresent)
				{
					new InsaneSourceMapRemover(this.sourceMap, this.mapTileSourceFactory, this.undoAddSourceMapDelegate, this.tryCount + 1);
					return;
				}
				string message;
				if (asyncRef.present is PresentFailureCode)
				{
					message = ((PresentFailureCode)asyncRef.present).exception.Message;
				}
				else
				{
					message = string.Format("Unexpected result type {0}", asyncRef.present.GetType().ToString());
				}
				this.undoAddSourceMapDelegate(message);
				return;
			}
		}
Пример #6
0
		public AsyncRecord(AsyncScheduler scheduler, IFuture cacheKeyToEvict, IFuture future)
		{
			this._cacheKeyToEvict = cacheKeyToEvict;
			this._future = future;
			this.scheduler = scheduler;
			this._present = null;
			this.asyncState = AsyncState.Prequeued;
			this.queuePriority = 0;
			this.qtpRef = new AsyncRef(this, "qRef");
		}
Пример #7
0
 public AsyncRecord(AsyncScheduler scheduler, IFuture cacheKeyToEvict, IFuture future)
 {
     this.cacheKeyToEvict = cacheKeyToEvict;
     this.future          = future;
     this.scheduler       = scheduler;
     present       = null;
     asyncState    = AsyncState.Prequeued;
     queuePriority = 0;
     qtpRef        = new AsyncRef(this, "qRef");
 }
		private void AsyncCompleteCallback(AsyncRef asyncRef)
		{
			Monitor.Enter(this);
			try
			{
				this.realizing = false;
				this.prioritizer.Complete(this);
				this.activeAsyncRef.Dispose();
				this.activeAsyncRef = null;
			}
			finally
			{
				Monitor.Exit(this);
			}
		}
 private void AsyncCompleteCallback(AsyncRef asyncRef)
 {
     Monitor.Enter(this);
     try
     {
         realizing = false;
         prioritizer.Complete(this);
         activeAsyncRef.Dispose();
         activeAsyncRef = null;
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Пример #10
0
        public override Present Realize(string refCredit)
        {
            Present present = this.asyncFuture.Realize(refCredit);

            if (present is AsyncRef)
            {
                AsyncRef asyncRef = (AsyncRef)present;
                asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.PresentReadyCallback));
                asyncRef.SetInterest(this.interestValue);
                AsyncRef asyncRef2 = (AsyncRef)asyncRef.Duplicate(refCredit + "2");
                new PersistentInterest(asyncRef);
                this.asyncReadyEvent.WaitOne();
                return(asyncRef2.present);
            }
            return(present);
        }
 public void Dispose()
 {
     Monitor.Enter(this);
     try
     {
         if (activeAsyncRef != null)
         {
             activeAsyncRef.Dispose();
             activeAsyncRef = null;
         }
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Пример #12
0
 private void Notify(Present presentValue)
 {
     Monitor.Enter(this);
     try
     {
         D.Assert(this._present == null);
         this._present        = presentValue;
         this.notificationRef = new AsyncRef(this, "callback");
         this.qtpRef          = null;
     }
     finally
     {
         Monitor.Exit(this);
     }
     DebugThreadInterrupter.theInstance.AddThread("AsyncRecord.NotifyThread", new ThreadStart(this.NotifyThread), ThreadPriority.Normal);
 }
Пример #13
0
		public void AddCallback(AsyncRecord.CompleteCallback callback)
		{
			Monitor.Enter(this);
			try
			{
				if (this.present != null)
				{
					AsyncRef asyncRef = new AsyncRef(this, "AsyncRecord.AddCallback");
					callback(asyncRef);
					asyncRef.Dispose();
				}
				else
				{
					this.callbackEvent = (AsyncRecord.CompleteCallback)Delegate.Combine(this.callbackEvent, callback);
				}
			}
			finally
			{
				Monitor.Exit(this);
			}
		}
Пример #14
0
 public void AddCallback(CompleteCallback callback)
 {
     Monitor.Enter(this);
     try
     {
         if (present != null)
         {
             AsyncRef asyncRef = new AsyncRef(this, "AsyncRecord.AddCallback");
             callback(asyncRef);
             asyncRef.Dispose();
         }
         else
         {
             callbackEvent = (CompleteCallback)Delegate.Combine(callbackEvent, callback);
         }
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Пример #15
0
 internal void ChangePriority(AsyncRef asyncRef)
 {
     this.qtp.ChangePriority(asyncRef);
 }
Пример #16
0
 private void BoundsRefAvailable(AsyncRef asyncRef)
 {
     base.Invalidate();
 }
Пример #17
0
 public void AsyncRecordComplete(AsyncRef asyncRef)
 {
     if (this.viewerControl.asyncRequestGeneration == this.generation)
     {
         this.viewerControl.InvalidateView();
     }
 }
Пример #18
0
 public void AsyncCompleteCallback(AsyncRef boundsAsyncRef)
 {
     this.interestList.Dispose();
 }
Пример #19
0
		internal void EvictFromCache(AsyncRef aref)
		{
			this.asyncRecordCache.Evict(aref.asyncRecord.cacheKeyToEvict);
		}
Пример #20
0
		private void PresentReadyCallback(AsyncRef asyncRef)
		{
			this.asyncReadyEvent.Set();
		}
Пример #21
0
		public void Add(AsyncRef aref)
		{
			this.list.AddLast(aref);
		}
Пример #22
0
		private void ImageBoundsAvailable(AsyncRef asyncRef)
		{
			this.StoreRenderRegion(asyncRef.present);
		}
Пример #23
0
		private void Notify(Present presentValue)
		{
			Monitor.Enter(this);
			try
			{
				D.Assert(this._present == null);
				this._present = presentValue;
				this.notificationRef = new AsyncRef(this, "callback");
				this.qtpRef = null;
			}
			finally
			{
				Monitor.Exit(this);
			}
			DebugThreadInterrupter.theInstance.AddThread("AsyncRecord.NotifyThread", new ThreadStart(this.NotifyThread), ThreadPriority.Normal);
		}
Пример #24
0
		internal void ChangePriority(AsyncRef asyncRef)
		{
			this.qtp.ChangePriority(asyncRef);
		}
Пример #25
0
 public void Add(AsyncRef aref)
 {
     this.list.AddLast(aref);
 }
		public void Dispose()
		{
			Monitor.Enter(this);
			try
			{
				if (this.activeAsyncRef != null)
				{
					this.activeAsyncRef.Dispose();
					this.activeAsyncRef = null;
				}
			}
			finally
			{
				Monitor.Exit(this);
			}
		}
Пример #27
0
		public void AsyncCompleteCallback(AsyncRef boundsAsyncRef)
		{
			this.interestList.Dispose();
		}
Пример #28
0
			public void Callback(AsyncRef asyncRef)
			{
				this.lop.AsyncReadyCallback(this);
			}
Пример #29
0
 private void PresentReadyCallback(AsyncRef asyncRef)
 {
     asyncReadyEvent.Set();
 }
Пример #30
0
 internal void EvictFromCache(AsyncRef aref)
 {
     this.asyncRecordCache.Evict(aref.asyncRecord.cacheKeyToEvict);
 }