Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / MS / Internal / IO / Packaging / TrackingMemoryStreamFactory.cs / 1 / TrackingMemoryStreamFactory.cs
//------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // This is a basic implementation of the ITrackingMemoryStreamFactory interface // // History: // 07/4/2005: IgorBel: Initial creation. // 11/08/2005: BruceMac: Change namespace // //----------------------------------------------------------------------------- using System; using System.IO; using System.Diagnostics; namespace MS.Internal.IO.Packaging { ////// TrackingMemoryStreamFactory class is used in the Sparse Memory Stream to keep track of the memory Usage /// internal class TrackingMemoryStreamFactory : ITrackingMemoryStreamFactory { public MemoryStream Create() { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this); } public MemoryStream Create(int capacity) { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this, capacity); } public void ReportMemoryUsageDelta(int delta) { checked{_bufferedMemoryConsumption += delta;} Debug.Assert(_bufferedMemoryConsumption >=0, "we end up having buffers of negative size"); } internal long CurrentMemoryConsumption { get { return _bufferedMemoryConsumption; } } private long _bufferedMemoryConsumption; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // This is a basic implementation of the ITrackingMemoryStreamFactory interface // // History: // 07/4/2005: IgorBel: Initial creation. // 11/08/2005: BruceMac: Change namespace // //----------------------------------------------------------------------------- using System; using System.IO; using System.Diagnostics; namespace MS.Internal.IO.Packaging { ////// TrackingMemoryStreamFactory class is used in the Sparse Memory Stream to keep track of the memory Usage /// internal class TrackingMemoryStreamFactory : ITrackingMemoryStreamFactory { public MemoryStream Create() { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this); } public MemoryStream Create(int capacity) { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this, capacity); } public void ReportMemoryUsageDelta(int delta) { checked{_bufferedMemoryConsumption += delta;} Debug.Assert(_bufferedMemoryConsumption >=0, "we end up having buffers of negative size"); } internal long CurrentMemoryConsumption { get { return _bufferedMemoryConsumption; } } private long _bufferedMemoryConsumption; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SpotLight.cs
- LinkAreaEditor.cs
- HttpCapabilitiesSectionHandler.cs
- OptimizerPatterns.cs
- DelegatingTypeDescriptionProvider.cs
- BufferBuilder.cs
- Properties.cs
- IntSecurity.cs
- EventLogConfiguration.cs
- AnimationLayer.cs
- OleDbConnectionInternal.cs
- MsmqElementBase.cs
- ContentPlaceHolderDesigner.cs
- StatusStrip.cs
- Vector3D.cs
- InfoCardProofToken.cs
- dbenumerator.cs
- XmlName.cs
- XPathSingletonIterator.cs
- WebScriptServiceHost.cs
- TextEditorSpelling.cs
- XmlAttributeCollection.cs
- MethodRental.cs
- BitmapCacheBrush.cs
- cache.cs
- XmlCharType.cs
- ResourceLoader.cs
- IdentityVerifier.cs
- WindowManager.cs
- SqlMethods.cs
- Drawing.cs
- MSAANativeProvider.cs
- ZipIOCentralDirectoryFileHeader.cs
- Semaphore.cs
- ToolStripItemImageRenderEventArgs.cs
- FixedStringLookup.cs
- EntitySqlQueryBuilder.cs
- DigitShape.cs
- ElementNotEnabledException.cs
- ExceptionUtility.cs
- DataTableTypeConverter.cs
- XPathException.cs
- XmlILModule.cs
- CookieProtection.cs
- TaskFileService.cs
- DesignerRegionMouseEventArgs.cs
- SafeBitVector32.cs
- CultureInfo.cs
- Span.cs
- IndividualDeviceConfig.cs
- PeerPresenceInfo.cs
- WindowsListBox.cs
- Timeline.cs
- PolicyLevel.cs
- TextBox.cs
- TextEditorContextMenu.cs
- XmlSchemaCompilationSettings.cs
- SqlFileStream.cs
- BuildResultCache.cs
- TypeLibConverter.cs
- LogLogRecordEnumerator.cs
- EarlyBoundInfo.cs
- QueryBranchOp.cs
- DataChangedEventManager.cs
- UInt16Storage.cs
- Privilege.cs
- ReachPrintTicketSerializerAsync.cs
- IItemContainerGenerator.cs
- PageHandlerFactory.cs
- DashStyles.cs
- ColorMap.cs
- QueueProcessor.cs
- ApplicationFileCodeDomTreeGenerator.cs
- Math.cs
- MessageBox.cs
- ApplicationInfo.cs
- PeerObject.cs
- UrlMappingsModule.cs
- Bezier.cs
- GeneralTransform3D.cs
- Literal.cs
- ThreadStaticAttribute.cs
- FrameworkElementFactory.cs
- control.ime.cs
- OciEnlistContext.cs
- CachedTypeface.cs
- SecurityContextTokenValidationException.cs
- ConnectionStringsSection.cs
- ArrayList.cs
- TextTreeNode.cs
- Rect.cs
- LogManagementAsyncResult.cs
- WebPartZone.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- GridViewSortEventArgs.cs
- TableLayoutColumnStyleCollection.cs
- NoResizeHandleGlyph.cs
- PermissionSetEnumerator.cs
- nulltextnavigator.cs
- FilterElement.cs