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
- PersonalizablePropertyEntry.cs
- SendKeys.cs
- GeometryGroup.cs
- Baml2006ReaderContext.cs
- TransactionInterop.cs
- TextBox.cs
- ReadOnlyHierarchicalDataSourceView.cs
- BitmapCache.cs
- EdmTypeAttribute.cs
- PageTrueTypeFont.cs
- FixedSOMPage.cs
- DebugViewWriter.cs
- PropertyChangingEventArgs.cs
- IdentityManager.cs
- LogReservationCollection.cs
- Normalization.cs
- FormViewPagerRow.cs
- InternalConfigEventArgs.cs
- GuidConverter.cs
- TypeUsage.cs
- InvalidPropValue.cs
- TextAutomationPeer.cs
- OleDbParameterCollection.cs
- HashAlgorithm.cs
- OleDbSchemaGuid.cs
- SchemaMapping.cs
- MultitargetUtil.cs
- Int32.cs
- DataGridViewRowEventArgs.cs
- KeyNameIdentifierClause.cs
- DockingAttribute.cs
- NoPersistScope.cs
- DoubleStorage.cs
- HttpApplicationFactory.cs
- DocumentPageViewAutomationPeer.cs
- HtmlEmptyTagControlBuilder.cs
- RelationshipType.cs
- XmlAnyElementAttribute.cs
- Guid.cs
- OutputCache.cs
- XamlToRtfWriter.cs
- SignedXml.cs
- SafeSerializationManager.cs
- MediaPlayerState.cs
- TrackPoint.cs
- Html32TextWriter.cs
- CodeEntryPointMethod.cs
- NativeMethods.cs
- Soap.cs
- TextCollapsingProperties.cs
- entitydatasourceentitysetnameconverter.cs
- ToolStripSystemRenderer.cs
- TypeDefinition.cs
- TypeConverterAttribute.cs
- PageParser.cs
- FormViewAutoFormat.cs
- PolyLineSegment.cs
- NativeMethods.cs
- SelectionManager.cs
- URIFormatException.cs
- HttpResponseHeader.cs
- DefaultPrintController.cs
- RewritingProcessor.cs
- NativeMethods.cs
- IndicShape.cs
- RevocationPoint.cs
- GroupStyle.cs
- BaseAutoFormat.cs
- HttpFileCollection.cs
- GuidelineCollection.cs
- TextElementEnumerator.cs
- DWriteFactory.cs
- DispatcherProcessingDisabled.cs
- FocusTracker.cs
- DataGridAutoFormat.cs
- SequenceNumber.cs
- COM2Enum.cs
- ContainerCodeDomSerializer.cs
- EntityDataSourceWizardForm.cs
- altserialization.cs
- ExpressionBinding.cs
- BrushValueSerializer.cs
- SymmetricKeyWrap.cs
- LowerCaseStringConverter.cs
- ADMembershipProvider.cs
- TransformConverter.cs
- PKCS1MaskGenerationMethod.cs
- ManagementEventArgs.cs
- StylusPointPropertyInfo.cs
- EntityDataSourceSelectedEventArgs.cs
- BaseInfoTable.cs
- CompiledIdentityConstraint.cs
- NotFiniteNumberException.cs
- StyleCollection.cs
- TrustLevel.cs
- NumericUpDownAccelerationCollection.cs
- XmlWrappingWriter.cs
- HtmlInputHidden.cs
- StrokeNodeOperations.cs
- EmptyStringExpandableObjectConverter.cs