1 write to _contextPool
PresentationFramework (1)
MS\Internal\PtsHost\PtsCache.cs (1)
146
_contextPool
= new List<ContextDesc>(1);
62 references to _contextPool
PresentationFramework (62)
MS\Internal\PtsHost\PtsCache.cs (62)
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
if (
_contextPool
[index].TextPenaltyModule != null)
338
_contextPool
[index].TextPenaltyModule.Dispose();
341
_contextPool
.RemoveAt(index);
377
for (index = 0; index <
_contextPool
.Count; index++)
379
if (
_contextPool
[index].PtsHost.Context == ptsContext.Context)
381
_contextPool
[index].Owner = new WeakReference(null);
382
_contextPool
[index].InUse = false;
386
Invariant.Assert(index <
_contextPool
.Count, "PtsContext not found in the context pool.");
397
if (cleanContextPool &&
_contextPool
.Count > 4)
401
while (index <
_contextPool
.Count)
403
if (!
_contextPool
[index].InUse)
405
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
406
PTS.Validate(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
407
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
408
PTS.Validate(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
411
if (
_contextPool
[index].TextPenaltyModule != null)
413
_contextPool
[index].TextPenaltyModule.Dispose();
415
_contextPool
.RemoveAt(index);
436
ptsHost =
_contextPool
[index].PtsHost;
440
InitInstalledObjectsInfo(ptsHost, ref
_contextPool
[index].SubtrackParaInfo, ref
_contextPool
[index].SubpageParaInfo, out installedObjects, out installedObjectsCount);
441
_contextPool
[index].InstalledObjects = installedObjects;
444
InitGenericInfo(ptsHost, (IntPtr)(index + 1), installedObjects, installedObjectsCount, ref
_contextPool
[index].ContextInfo);
447
InitFloaterObjInfo(ptsHost, ref
_contextPool
[index].FloaterInit);
448
InitTableObjInfo(ptsHost, ref
_contextPool
[index].TableobjInit);
451
if (
_contextPool
[index].IsOptimalParagraphEnabled)
457
_contextPool
[index].TextPenaltyModule = penaltyModule;
458
_contextPool
[index].ContextInfo.ptsPenaltyModule = ptsPenaltyModule;
459
_contextPool
[index].TextFormatter = TextFormatter.CreateFromContext(textFormatterContext, textFormattingMode);
465
GC.SuppressFinalize(
_contextPool
[index].TextPenaltyModule);
469
PTS.Validate(PTS.CreateDocContext(ref
_contextPool
[index].ContextInfo, out context));