Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- PermissionSet.cs
- KeyConstraint.cs
- TcpServerChannel.cs
- SqlInternalConnectionTds.cs
- EventMappingSettings.cs
- IDispatchConstantAttribute.cs
- ListControlDataBindingHandler.cs
- ServiceNotStartedException.cs
- DataTableMappingCollection.cs
- ToolTip.cs
- XmlQueryOutput.cs
- BufferedGraphicsManager.cs
- AutomationPatternInfo.cs
- __Error.cs
- TransformPattern.cs
- CollectionType.cs
- RuntimeEnvironment.cs
- SplitContainer.cs
- XmlArrayAttribute.cs
- Models.cs
- Certificate.cs
- TextOnlyOutput.cs
- ExtendedPropertyDescriptor.cs
- PropertyMapper.cs
- Type.cs
- LicenseManager.cs
- BitmapSource.cs
- ConstructorArgumentAttribute.cs
- GeneratedContractType.cs
- SymbolTable.cs
- ReadWriteObjectLock.cs
- RegexMatch.cs
- BulletDecorator.cs
- HtmlHead.cs
- HitTestWithGeometryDrawingContextWalker.cs
- MsmqHostedTransportManager.cs
- MethodBody.cs
- DiscriminatorMap.cs
- PersianCalendar.cs
- SafeNativeMethodsCLR.cs
- ObjectQueryProvider.cs
- DataGrid.cs
- CharacterMetrics.cs
- Calendar.cs
- Command.cs
- sitestring.cs
- ListItemParagraph.cs
- FormsAuthentication.cs
- WSHttpBindingElement.cs
- AuthorizationSection.cs
- DataServiceRequest.cs
- EditingCoordinator.cs
- DesigntimeLicenseContext.cs
- TextDecorationUnitValidation.cs
- TextServicesCompartment.cs
- MembershipValidatePasswordEventArgs.cs
- UnsafeNativeMethods.cs
- unsafenativemethodstextservices.cs
- ChtmlLinkAdapter.cs
- TrustLevelCollection.cs
- ApplicationTrust.cs
- ZipFileInfoCollection.cs
- HandoffBehavior.cs
- HttpFileCollection.cs
- ScriptControlManager.cs
- SelectionRangeConverter.cs
- UnsafeNativeMethodsTablet.cs
- ISFTagAndGuidCache.cs
- DefaultValueTypeConverter.cs
- LineProperties.cs
- XmlDataSource.cs
- QilGenerator.cs
- MsmqProcessProtocolHandler.cs
- ADMembershipUser.cs
- SeekStoryboard.cs
- BitmapEffectDrawingContextState.cs
- Sorting.cs
- SizeValueSerializer.cs
- CodeTypeParameterCollection.cs
- QilLiteral.cs
- LogEntryHeaderv1Deserializer.cs
- FileDetails.cs
- AliasExpr.cs
- AssemblyBuilder.cs
- WebSysDefaultValueAttribute.cs
- CounterSample.cs
- LinqDataSourceEditData.cs
- ToolStripPanelDesigner.cs
- InternalSafeNativeMethods.cs
- DataSourceProvider.cs
- WebPartConnectionsEventArgs.cs
- ForceCopyBuildProvider.cs
- ContentFileHelper.cs
- Int32RectConverter.cs
- XsltLoader.cs
- CompiledRegexRunnerFactory.cs
- FactorySettingsElement.cs
- EncryptedData.cs
- DesignerDataView.cs
- Selector.cs