Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / IO / Packaging / TrackingMemoryStreamFactory.cs / 1305600 / 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
- HttpServerVarsCollection.cs
- PointValueSerializer.cs
- PenThreadWorker.cs
- RegexFCD.cs
- FactoryGenerator.cs
- XmlResolver.cs
- XmlDataLoader.cs
- GeometryConverter.cs
- FormViewRow.cs
- InternalTypeHelper.cs
- ButtonChrome.cs
- RangeValidator.cs
- DetailsViewUpdateEventArgs.cs
- AccessedThroughPropertyAttribute.cs
- ObjectParameter.cs
- SapiInterop.cs
- QilNode.cs
- SqlXml.cs
- TitleStyle.cs
- WhitespaceReader.cs
- SequenceDesigner.cs
- ChtmlCommandAdapter.cs
- SuppressIldasmAttribute.cs
- MsmqIntegrationValidationBehavior.cs
- FrameDimension.cs
- securitycriticaldataformultiplegetandset.cs
- TextBreakpoint.cs
- Stroke.cs
- SubpageParaClient.cs
- DerivedKeySecurityTokenStub.cs
- SignedXml.cs
- ComponentResourceKey.cs
- StrongNameMembershipCondition.cs
- MSHTMLHost.cs
- Utility.cs
- ChannelEndpointElement.cs
- cookieexception.cs
- ButtonFlatAdapter.cs
- FacetChecker.cs
- HttpAsyncResult.cs
- DoubleAnimationUsingPath.cs
- ThreadExceptionEvent.cs
- Label.cs
- NameService.cs
- ExpressionConverter.cs
- MSAAWinEventWrap.cs
- DeclarativeCatalogPart.cs
- XsltContext.cs
- SqlUtils.cs
- Journaling.cs
- TextAction.cs
- EncoderNLS.cs
- ProviderUtil.cs
- fixedPageContentExtractor.cs
- DoubleAnimationUsingKeyFrames.cs
- JsonEnumDataContract.cs
- DbMetaDataFactory.cs
- ForceCopyBuildProvider.cs
- SynchronizingStream.cs
- PropertyDescriptorComparer.cs
- WpfGeneratedKnownTypes.cs
- EpmContentDeSerializer.cs
- TreeNodeSelectionProcessor.cs
- WebPartVerbCollection.cs
- DataGridViewHeaderCell.cs
- MsmqHostedTransportConfiguration.cs
- NativeMethods.cs
- ImageMapEventArgs.cs
- ClosableStream.cs
- EventLevel.cs
- InstanceKeyCompleteException.cs
- CustomSignedXml.cs
- ProcessModelInfo.cs
- CompiledRegexRunner.cs
- RadioButtonList.cs
- _UncName.cs
- MailAddressCollection.cs
- RangeValidator.cs
- InternalCache.cs
- TypeHelper.cs
- WindowsListViewItemCheckBox.cs
- EdmProviderManifest.cs
- SoapCodeExporter.cs
- FloaterBaseParaClient.cs
- DataException.cs
- StylusDevice.cs
- PropertyChangingEventArgs.cs
- PieceDirectory.cs
- XmlBinaryReader.cs
- DataGridItem.cs
- LinkUtilities.cs
- NumberFormatInfo.cs
- ListBindingHelper.cs
- XmlSchemaInferenceException.cs
- ToolboxBitmapAttribute.cs
- DataGridComboBoxColumn.cs
- UnsafeNetInfoNativeMethods.cs
- FixedTextContainer.cs
- KeySpline.cs
- WebPartConnectionsDisconnectVerb.cs