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
- TextReader.cs
- ProfileSection.cs
- LineInfo.cs
- ShutDownListener.cs
- MetadataFile.cs
- cookieexception.cs
- HwndHost.cs
- QueryAccessibilityHelpEvent.cs
- DelegatingTypeDescriptionProvider.cs
- TransportConfigurationTypeElementCollection.cs
- SubpageParagraph.cs
- CqlParser.cs
- KnownAssemblyEntry.cs
- XmlDataImplementation.cs
- XmlSchemaNotation.cs
- ProviderUtil.cs
- PermissionSet.cs
- OracleCommand.cs
- CompositeScriptReferenceEventArgs.cs
- DataTemplate.cs
- x509utils.cs
- MethodRental.cs
- XmlnsDictionary.cs
- StrokeRenderer.cs
- GeneratedCodeAttribute.cs
- Cell.cs
- SchemaImporter.cs
- Switch.cs
- ServerIdentity.cs
- PropertyDescriptorCollection.cs
- ServiceOperationParameter.cs
- MasterPageCodeDomTreeGenerator.cs
- X509Certificate2.cs
- AssemblyHelper.cs
- ObjectDataSourceStatusEventArgs.cs
- FixedPage.cs
- TransformationRules.cs
- SrgsGrammar.cs
- ProgressBarBrushConverter.cs
- AccessedThroughPropertyAttribute.cs
- UserNameSecurityToken.cs
- Compiler.cs
- MaterialCollection.cs
- SchemaInfo.cs
- ControlValuePropertyAttribute.cs
- RemoteWebConfigurationHostStream.cs
- EventHandlerService.cs
- DateRangeEvent.cs
- RootContext.cs
- ObjectSet.cs
- XmlAttributeHolder.cs
- QueryReaderSettings.cs
- AsynchronousChannelMergeEnumerator.cs
- AssemblyName.cs
- ScriptingAuthenticationServiceSection.cs
- DataServiceCollectionOfT.cs
- OutputCacheSettingsSection.cs
- DataGridViewComponentPropertyGridSite.cs
- FastPropertyAccessor.cs
- ErrorInfoXmlDocument.cs
- GridViewColumnHeaderAutomationPeer.cs
- AtomContentProperty.cs
- InlineUIContainer.cs
- UnauthorizedAccessException.cs
- SequentialUshortCollection.cs
- DescendantBaseQuery.cs
- _ListenerResponseStream.cs
- InvalidOperationException.cs
- ApplyImportsAction.cs
- ProxyHelper.cs
- MultipleCopiesCollection.cs
- RequestResizeEvent.cs
- ServiceModelConfiguration.cs
- BasePattern.cs
- MemberCollection.cs
- TimeSpanStorage.cs
- HttpUnhandledOperationInvoker.cs
- SettingsPropertyValue.cs
- RenderDataDrawingContext.cs
- QueryCreatedEventArgs.cs
- NumberFormatInfo.cs
- WebExceptionStatus.cs
- DataGridColumn.cs
- HiddenFieldDesigner.cs
- SystemException.cs
- DbFunctionCommandTree.cs
- FixedSOMPageElement.cs
- ToolboxDataAttribute.cs
- AstNode.cs
- AssemblyFilter.cs
- TextTreeExtractElementUndoUnit.cs
- ACE.cs
- TraceUtility.cs
- Decorator.cs
- DbCommandTree.cs
- SignatureDescription.cs
- RegexTypeEditor.cs
- MeshGeometry3D.cs
- X509Certificate2.cs
- XmlSchemaAttribute.cs