1 write to _contextPool
PresentationFramework (1)
src\Framework\MS\Internal\PtsHost\PtsCache.cs (1)
167
_contextPool
= new List<ContextDesc>(1);
62 references to _contextPool
PresentationFramework (62)
src\Framework\MS\Internal\PtsHost\PtsCache.cs (62)
214
for (index = 0; index <
_contextPool
.Count; index++)
216
if (!
_contextPool
[index].InUse &&
217
_contextPool
[index].IsOptimalParagraphEnabled == ptsContext.IsOptimalParagraphEnabled)
224
if (index ==
_contextPool
.Count)
226
_contextPool
.Add(new ContextDesc());
227
_contextPool
[index].IsOptimalParagraphEnabled = ptsContext.IsOptimalParagraphEnabled;
228
_contextPool
[index].PtsHost = new PtsHost();
229
_contextPool
[index].PtsHost.Context = CreatePTSContext(index, textFormattingMode);
234
if (
_contextPool
[index].IsOptimalParagraphEnabled)
236
ptsContext.TextFormatter =
_contextPool
[index].TextFormatter;
240
_contextPool
[index].InUse = true;
241
_contextPool
[index].Owner = new WeakReference(ptsContext);
243
return
_contextPool
[index].PtsHost;
289
for (index = 0; index <
_contextPool
.Count; index++)
291
if (
_contextPool
[index].PtsHost == ptsHost)
296
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the Context pool.");
297
PTS.Validate(PTS.GetFloaterHandlerInfo(ref
_contextPool
[index].FloaterInit, pobjectinfo));
316
for (index = 0; index <
_contextPool
.Count; index++)
318
if (
_contextPool
[index].PtsHost == ptsHost)
323
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the context pool.");
324
PTS.Validate(PTS.GetTableObjHandlerInfo(ref
_contextPool
[index].TableobjInit, pobjectinfo));
365
while (index <
_contextPool
.Count)
367
PtsContext ptsContext =
_contextPool
[index].Owner.Target as PtsContext;
370
Invariant.Assert(
_contextPool
[index].PtsHost.Context == ptsContext.Context, "PTS Context mismatch.");
371
_contextPool
[index].Owner = new WeakReference(null);
372
_contextPool
[index].InUse = false;
378
if (!
_contextPool
[index].InUse)
383
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
384
PTS.IgnoreError(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
385
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
386
PTS.IgnoreError(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
389
if (
_contextPool
[index].TextPenaltyModule != null)
391
_contextPool
[index].TextPenaltyModule.Dispose();
394
_contextPool
.RemoveAt(index);
440
for (index = 0; index <
_contextPool
.Count; index++)
442
if (
_contextPool
[index].PtsHost.Context == ptsContext.Context)
444
_contextPool
[index].Owner = new WeakReference(null);
445
_contextPool
[index].InUse = false;
449
Invariant.Assert(index <
_contextPool
.Count, "PtsContext not found in the context pool.");
460
if (cleanContextPool &&
_contextPool
.Count > 4)
464
while (index <
_contextPool
.Count)
466
if (!
_contextPool
[index].InUse)
468
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
469
PTS.Validate(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
470
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
471
PTS.Validate(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
474
if (
_contextPool
[index].TextPenaltyModule != null)
476
_contextPool
[index].TextPenaltyModule.Dispose();
478
_contextPool
.RemoveAt(index);
507
ptsHost =
_contextPool
[index].PtsHost;
511
InitInstalledObjectsInfo(ptsHost, ref
_contextPool
[index].SubtrackParaInfo, ref
_contextPool
[index].SubpageParaInfo, out installedObjects, out installedObjectsCount);
512
_contextPool
[index].InstalledObjects = installedObjects;
515
InitGenericInfo(ptsHost, (IntPtr)(index + 1), installedObjects, installedObjectsCount, ref
_contextPool
[index].ContextInfo);
518
InitFloaterObjInfo(ptsHost, ref
_contextPool
[index].FloaterInit);
519
InitTableObjInfo(ptsHost, ref
_contextPool
[index].TableobjInit);
522
if (
_contextPool
[index].IsOptimalParagraphEnabled)
528
_contextPool
[index].TextPenaltyModule = penaltyModule;
529
_contextPool
[index].ContextInfo.ptsPenaltyModule = ptsPenaltyModule;
530
_contextPool
[index].TextFormatter = TextFormatter.CreateFromContext(textFormatterContext, textFormattingMode);
536
GC.SuppressFinalize(
_contextPool
[index].TextPenaltyModule);
540
PTS.Validate(PTS.CreateDocContext(ref
_contextPool
[index].ContextInfo, out context));