bool IDependencyAnalysisMarkStrategy <DependencyContextType> .MarkNode( DependencyNodeCore <DependencyContextType> node, DependencyNodeCore <DependencyContextType> reasonNode, DependencyNodeCore <DependencyContextType> reasonNode2, string reason) { bool retVal = false; int nodeIndex; if (!node.Marked) { nodeIndex = Interlocked.Increment(ref ObjectIndex); node.SetMark(nodeIndex); if (GraphId == 0) { lock (GraphEventSource.Log) { if (GraphId == 0) { GraphId = Interlocked.Increment(ref s_GraphIds); GraphEventSource.Log.Graph(GraphId, ""); RootIndex = Interlocked.Increment(ref ObjectIndex); GraphEventSource.Log.Node(GraphId, RootIndex, "roots"); } } } retVal = true; GraphEventSource.Log.Node(GraphId, nodeIndex, node.GetNameInternal(_context)); } else { nodeIndex = (int)node.GetMark(); } if (reasonNode != null) { if (reasonNode2 != null) { GraphEventSource.Log.ConditionalEdge(GraphId, (int)reasonNode.GetMark(), (int)reasonNode2.GetMark(), nodeIndex, reason); } else { GraphEventSource.Log.Edge(GraphId, (int)reasonNode.GetMark(), nodeIndex, reason); } } else { GraphEventSource.Log.Edge(GraphId, RootIndex, nodeIndex, reason); } return(retVal); }
bool IDependencyAnalysisMarkStrategy <DependencyContextType> .MarkNode( DependencyNodeCore <DependencyContextType> node, DependencyNodeCore <DependencyContextType> reasonNode, DependencyNodeCore <DependencyContextType> reasonNode2, string reason) { bool newlyMarked = !node.Marked; HashSet <MarkData> associatedNodes; if (newlyMarked) { associatedNodes = new HashSet <MarkData>(MarkDataEqualityComparer.Default); node.SetMark(associatedNodes); } else { associatedNodes = (HashSet <MarkData>)node.GetMark(); } if ((reasonNode == null) && (reasonNode2 == null)) { Debug.Assert(reason != null); if (_reasonStringOnlyNodes == null) { _reasonStringOnlyNodes = new HashSet <string>(); } _reasonStringOnlyNodes.Add(reason); } associatedNodes.Add(new MarkData(reason, reasonNode, reasonNode2)); return(newlyMarked); }