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
- ToolBarTray.cs
- UriSection.cs
- PersonalizationStateInfo.cs
- CollectionType.cs
- StdRegProviderWrapper.cs
- HtmlTernaryTree.cs
- DetailsViewModeEventArgs.cs
- AstNode.cs
- PageOutputQuality.cs
- TypographyProperties.cs
- EntityCommand.cs
- TableStyle.cs
- WebPartHelpVerb.cs
- ToolStripDesignerUtils.cs
- BaseProcessor.cs
- EndPoint.cs
- FormatterServices.cs
- UidManager.cs
- SymbolDocumentGenerator.cs
- JavaScriptObjectDeserializer.cs
- UIPropertyMetadata.cs
- IfJoinedCondition.cs
- StateMachine.cs
- FrameworkPropertyMetadata.cs
- ContentDisposition.cs
- File.cs
- InheritablePropertyChangeInfo.cs
- ObjectCacheHost.cs
- PriorityItem.cs
- PopupControlService.cs
- UpdateExpressionVisitor.cs
- QilInvokeLateBound.cs
- DNS.cs
- ProviderException.cs
- CompoundFileReference.cs
- AnimatedTypeHelpers.cs
- AsyncStreamReader.cs
- InternalCache.cs
- PackageFilter.cs
- CodePageUtils.cs
- DataGridViewAccessibleObject.cs
- CfgArc.cs
- ObjectCloneHelper.cs
- TimeSpanStorage.cs
- WebBrowserSiteBase.cs
- TextHidden.cs
- DataGridViewImageColumn.cs
- MessageRpc.cs
- TextOutput.cs
- LineVisual.cs
- ToolStrip.cs
- DPAPIProtectedConfigurationProvider.cs
- XmlFormatExtensionPrefixAttribute.cs
- HtmlTitle.cs
- XPathSelfQuery.cs
- DesignerCommandAdapter.cs
- XmlBaseReader.cs
- BamlResourceContent.cs
- Schema.cs
- PagerSettings.cs
- RelatedImageListAttribute.cs
- InfoCardXmlSerializer.cs
- CodeDirectoryCompiler.cs
- MaskedTextBox.cs
- DataGridItemEventArgs.cs
- TextBlockAutomationPeer.cs
- PathData.cs
- CodeActivityMetadata.cs
- TextRangeProviderWrapper.cs
- SoundPlayerAction.cs
- _NestedSingleAsyncResult.cs
- OletxTransactionManager.cs
- Point3DKeyFrameCollection.cs
- BuildProviderCollection.cs
- FormViewRow.cs
- CommentAction.cs
- ByteBufferPool.cs
- SmtpSection.cs
- RegisteredDisposeScript.cs
- XamlSerializerUtil.cs
- SQlBooleanStorage.cs
- Int32Rect.cs
- IconEditor.cs
- GroupDescription.cs
- IsolatedStorageFile.cs
- SelectingProviderEventArgs.cs
- RoleGroup.cs
- DynamicFilterExpression.cs
- EventPropertyMap.cs
- XmlSchemaAnyAttribute.cs
- DataTableReaderListener.cs
- FilteredReadOnlyMetadataCollection.cs
- NameValueCollection.cs
- DeclarationUpdate.cs
- RandomDelaySendsAsyncResult.cs
- XmlFormatExtensionPointAttribute.cs
- TreeNodeConverter.cs
- Types.cs
- PostBackTrigger.cs
- SharedConnectionWorkflowTransactionService.cs