public static bool HasHotIcon(this IDeclaredElement element, SolutionAnalysisService swa,
                                      CallGraphSwaExtensionProvider callGraphSwaExtensionProvider, IContextBoundSettingsStore settingsStore,
                                      PerformanceCriticalCodeCallGraphAnalyzer analyzer, DaemonProcessKind kind)
        {
            if (!settingsStore.GetValue((UnitySettings key) => key.EnableIconsForPerformanceCriticalCode))
            {
                return(false);
            }

            if (!settingsStore.GetValue((UnitySettings key) => key.EnablePerformanceCriticalCodeHighlighting))
            {
                return(false);
            }

            var usageChecker = swa.UsageChecker;

            if (usageChecker == null)
            {
                return(false);
            }

            var id = swa.GetElementId(element);

            if (!id.HasValue)
            {
                return(false);
            }

            return(callGraphSwaExtensionProvider.IsMarkedByCallGraphAnalyzer(analyzer.Id, id.Value,
                                                                             kind == DaemonProcessKind.GLOBAL_WARNINGS));
        }
        private bool IsPerformanceCriticalDeclaration(ITreeNode element)
        {
            if (!(element is ICSharpDeclaration declaration))
            {
                return(false);
            }

            var declaredElement = declaration.DeclaredElement;

            if (declaredElement == null)
            {
                return(false);
            }

            if (myProcessKind == DaemonProcessKind.GLOBAL_WARNINGS)
            {
                var id = myProvider.GetElementId(declaredElement);
                if (!id.HasValue)
                {
                    return(false);
                }

                return(myCallGraphSwaExtensionProvider.IsMarkedByCallGraphAnalyzer(
                           myPerformanceCriticalCodeCallGraphMarksProvider.Id,
                           true, id.Value));
            }

            return(PerformanceCriticalCodeStageUtil.IsPerformanceCriticalRootMethod(myAPI, declaration));
        }
        private bool IsMarked(IGlobalUsageChecker usageChecker, CallGraphAnalyzerId analyzerId, IDeclaredElement element)
        {
            if (element == null)
            {
                return(false);
            }
            var id = mySwa.GetElementId(element, true);

            if (!id.HasValue)
            {
                return(false);
            }

            return(myTracker.RegisterCallGraphQueryTime(() =>
                                                        myCallGraphSwaExtensionProvider.IsMarkedByCallGraphAnalyzer(analyzerId, id.Value, true)));
        }
        public static bool HasHotIcon(this IDeclaredElement element,
                                      CallGraphSwaExtensionProvider callGraphSwaExtensionProvider, IContextBoundSettingsStore settingsStore,
                                      PerformanceCriticalCodeCallGraphMarksProvider marksProvider, DaemonProcessKind kind, IElementIdProvider provider)
        {
            if (!settingsStore.GetValue((UnitySettings key) => key.EnableIconsForPerformanceCriticalCode))
            {
                return(false);
            }

            if (!settingsStore.GetValue((UnitySettings key) => key.EnablePerformanceCriticalCodeHighlighting))
            {
                return(false);
            }

            var id = provider.GetElementId(element);

            if (!id.HasValue)
            {
                return(false);
            }

            return(callGraphSwaExtensionProvider.IsMarkedByCallGraphAnalyzer(marksProvider.Id,
                                                                             kind == DaemonProcessKind.GLOBAL_WARNINGS, id.Value));
        }