1 write to _contextPool
PresentationFramework (1)
MS\Internal\PtsHost\PtsCache.cs (1)
146
_contextPool
= new List<ContextDesc>(1);
60 references to _contextPool
PresentationFramework (60)
MS\Internal\PtsHost\PtsCache.cs (60)
183
for (index = 0; index <
_contextPool
.Count; index++)
185
if (!
_contextPool
[index].InUse &&
186
_contextPool
[index].IsOptimalParagraphEnabled == ptsContext.IsOptimalParagraphEnabled)
194
if (index ==
_contextPool
.Count)
196
_contextPool
.Add(new ContextDesc());
197
_contextPool
[index].IsOptimalParagraphEnabled = ptsContext.IsOptimalParagraphEnabled;
198
_contextPool
[index].PtsHost = new PtsHost();
199
_contextPool
[index].PtsHost.Context = CreatePTSContext(index, textFormattingMode);
205
if (
_contextPool
[index].IsOptimalParagraphEnabled)
207
ptsContext.TextFormatter =
_contextPool
[index].TextFormatter;
211
_contextPool
[index].InUse = true;
212
_contextPool
[index].Owner = new WeakReference(ptsContext);
214
return
_contextPool
[index].PtsHost;
252
for (index = 0; index <
_contextPool
.Count; index++)
254
if (
_contextPool
[index].PtsHost == ptsHost)
259
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the Context pool.");
260
PTS.Validate(PTS.GetFloaterHandlerInfo(ref
_contextPool
[index].FloaterInit, pobjectinfo));
271
for (index = 0; index <
_contextPool
.Count; index++)
273
if (
_contextPool
[index].PtsHost == ptsHost)
278
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the context pool.");
279
PTS.Validate(PTS.GetTableObjHandlerInfo(ref
_contextPool
[index].TableobjInit, pobjectinfo));
312
while (index <
_contextPool
.Count)
314
PtsContext ptsContext =
_contextPool
[index].Owner.Target as PtsContext;
317
Invariant.Assert(
_contextPool
[index].PtsHost.Context == ptsContext.Context, "PTS Context mismatch.");
318
_contextPool
[index].Owner = new WeakReference(null);
319
_contextPool
[index].InUse = false;
325
if (!
_contextPool
[index].InUse)
330
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
331
PTS.IgnoreError(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
332
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
333
PTS.IgnoreError(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
336
_contextPool
[index].TextPenaltyModule?.Dispose();
338
_contextPool
.RemoveAt(index);
374
for (index = 0; index <
_contextPool
.Count; index++)
376
if (
_contextPool
[index].PtsHost.Context == ptsContext.Context)
378
_contextPool
[index].Owner = new WeakReference(null);
379
_contextPool
[index].InUse = false;
383
Invariant.Assert(index <
_contextPool
.Count, "PtsContext not found in the context pool.");
394
if (cleanContextPool &&
_contextPool
.Count > 4)
398
while (index <
_contextPool
.Count)
400
if (!
_contextPool
[index].InUse)
402
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
403
PTS.Validate(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
404
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
405
PTS.Validate(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
408
_contextPool
[index].TextPenaltyModule?.Dispose();
409
_contextPool
.RemoveAt(index);
430
ptsHost =
_contextPool
[index].PtsHost;
434
InitInstalledObjectsInfo(ptsHost, ref
_contextPool
[index].SubtrackParaInfo, ref
_contextPool
[index].SubpageParaInfo, out installedObjects, out installedObjectsCount);
435
_contextPool
[index].InstalledObjects = installedObjects;
438
InitGenericInfo(ptsHost, (IntPtr)(index + 1), installedObjects, installedObjectsCount, ref
_contextPool
[index].ContextInfo);
441
InitFloaterObjInfo(ptsHost, ref
_contextPool
[index].FloaterInit);
442
InitTableObjInfo(ptsHost, ref
_contextPool
[index].TableobjInit);
445
if (
_contextPool
[index].IsOptimalParagraphEnabled)
451
_contextPool
[index].TextPenaltyModule = penaltyModule;
452
_contextPool
[index].ContextInfo.ptsPenaltyModule = ptsPenaltyModule;
453
_contextPool
[index].TextFormatter = TextFormatter.CreateFromContext(textFormatterContext, textFormattingMode);
459
GC.SuppressFinalize(
_contextPool
[index].TextPenaltyModule);
463
PTS.Validate(PTS.CreateDocContext(ref
_contextPool
[index].ContextInfo, out context));