public void FinishTopLevelCallSafe(Call topLevelCall)
 {
     lock (m_EventsUnSafe)
     {
         // Careful here, calling "Safe" function which means another lock is being acquired inside the current lock.
         m_EventForCurrentTopLevelCall.AddTopLevelCallSafe(topLevelCall);
         m_EventForCurrentTopLevelCall = null;
     }
 }
 public void AddTopLevelCallSafe(Call call)
 {
     lock (m_TopLevelCallsUnSafe)
     {
         var top = new TopLevelCall(call);
         m_TopLevelCallsUnSafe.Add(top);
         m_TopLevelCallsCountAll++;
         m_TopLevelCallsCountFiltered += top.HasFilteredVersion ? 1 : 0;
     }
 }
 private void NotifyCallSiteChanged(Call callSite, int callSiteLine)
 {
     CallSite = callSite;
     CallSiteLine = callSiteLine;
 }
 public int IndexOfSubCall(Call call)
 {
     return m_SubCalls.IndexOf(call);
 }
        public Call FilterDojoJQuery(bool fromOk, Call parent)
        {
            bool ok = !IsDojoJQuery();

            Call c, p;
            if (ok)
            {
                c = this.Clone();
                p = c;
            }
            else if (fromOk)
            {
                c = this.Clone();
                p = null;
            }
            else if (parent == null)
            {
                c = this.Clone();
                c.IsFiltered = true;
                p = c;
            }
            else
            {
                c = parent;
                p = parent;
            }

            foreach (Call z in this.SubCalls.Select(call => call.FilterDojoJQuery(ok, p)).Where(call => call != null))
                if (c != z)
                    c.AddSubCall(z, c.IsFiltered ? -1 : z.CallSiteLine);

            if (c.IsFiltered && c.SubCallsCount == 0)
                return null;
            else
                return c;
        }
 public Call Clone()
 {
     Call call = new Call(Script);
     call.CallSite = CallSite;
     call.CallSiteLine = CallSiteLine;
     call.ReturnLine = ReturnLine;
     call.IsFiltered = IsFiltered;
     call.Xhrs = Xhrs;
     call.IntervalTimeouts = IntervalTimeouts;
     call.XhrInfo = XhrInfo;
     call.IntervalTimeoutInfo = IntervalTimeoutInfo;
     return call;
 }
 public void AddSubCall(Call call, int callSiteLine)
 {
     m_SubCalls.Add(call);
     call.NotifyCallSiteChanged(this, callSiteLine);
 }
 public static Call CreateTopLevel(Script script)
 {
     Call call = new Call(script);
     call.Xhrs = new List<Xhr>();
     call.IntervalTimeouts = new List<IntervalTimeout>();
     return call;
 }
 public void SetSend(Call call)
 {
     XhrEvents.Add(new XhrEvent() { Type = XhrEventType.Send, Call = call });
 }
 public void AddEval(Call call)
 {
     XhrEvents.Add(new XhrEvent() { Type = XhrEventType.Eval, Call = call });
 }
 public void AddAccess(Call call)
 {
     // Prevent duplicate adds (simple, but good enough)
     if (XhrEvents.Where(xe => xe.Type == XhrEventType.Access).Select(xe => xe.Call).LastOrDefault() != call)
         XhrEvents.Add(new XhrEvent() { Type = XhrEventType.Access, Call = call });
 }
 public TopLevelCall(Call root)
 {
     Root = root;
     FilteredRoot = root.FilterDojoJQuery(false, null);
 }