⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profilespanel.js

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 JS
📖 第 1 页 / 共 2 页
字号:
        if (this.visibleView)            this.visibleView.hide();        delete this.visibleView;    },    displayTitleForProfileLink: function(title)    {        title = unescape(title);        if (title.indexOf(UserInitiatedProfileName) === 0) {            title = WebInspector.UIString("Profile %d", title.substring(UserInitiatedProfileName.length + 1));        } else {            if (!(title in this._profileGroupsForLinks))                this._profileGroupsForLinks[title] = 0;            groupNumber = ++this._profileGroupsForLinks[title];            if (groupNumber >= 2)                title += " " + WebInspector.UIString("Run %d", groupNumber);        }                return title;    },    get searchableViews()    {        var views = [];        const visibleView = this.visibleView;        if (visibleView && visibleView.performSearch)            views.push(visibleView);        var profilesLength = this._profiles.length;        for (var i = 0; i < profilesLength; ++i) {            var view = this.profileViewForProfile(this._profiles[i]);            if (!view.performSearch || view === visibleView)                continue;            views.push(view);        }        return views;    },    searchMatchFound: function(view, matches)    {        // Always use the treeProfile, since the heavy profile might be showing.        view.profile.treeProfile._profilesTreeElement.searchMatches = matches;    },    searchCanceled: function(startingNewSearch)    {        WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);        if (!this._profiles)            return;        for (var i = 0; i < this._profiles.length; ++i) {            var profile = this._profiles[i];            profile._profilesTreeElement.searchMatches = 0;        }    },    setRecordingProfile: function(isProfiling)    {        this.recording = isProfiling;        if (isProfiling) {            this.recordButton.addStyleClass("toggled-on");            this.recordButton.title = WebInspector.UIString("Stop profiling.");        } else {            this.recordButton.removeStyleClass("toggled-on");            this.recordButton.title = WebInspector.UIString("Start profiling.");        }    },    _updateInterface: function()    {        if (InspectorController.profilerEnabled()) {            this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable.");            this.enableToggleButton.addStyleClass("toggled-on");            this.recordButton.removeStyleClass("hidden");            this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");            this.panelEnablerView.visible = false;        } else {            this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");            this.enableToggleButton.removeStyleClass("toggled-on");            this.recordButton.addStyleClass("hidden");            this.profileViewStatusBarItemsContainer.addStyleClass("hidden");            this.panelEnablerView.visible = true;        }    },    _recordClicked: function()    {        this.recording = !this.recording;        if (this.recording)            InspectorController.startProfiling();        else            InspectorController.stopProfiling();    },    _enableProfiling: function()    {        if (InspectorController.profilerEnabled())            return;        this._toggleProfiling();    },    _toggleProfiling: function()    {        if (InspectorController.profilerEnabled())            InspectorController.disableProfiler();        else            InspectorController.enableProfiler();    },    _populateProfiles: function()    {        if (this.sidebarTree.children.length)            return;        var profiles = InspectorController.profiles();        var profilesLength = profiles.length;        for (var i = 0; i < profilesLength; ++i) {            var profile = profiles[i];            this.addProfile(profile);        }        if (this.sidebarTree.children[0])            this.sidebarTree.children[0].select();        delete this._shouldPopulateProfiles;    },    _startSidebarDragging: function(event)    {        WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize");    },    _sidebarDragging: function(event)    {        this._updateSidebarWidth(event.pageX);        event.preventDefault();    },    _endSidebarDragging: function(event)    {        WebInspector.elementDragEnd(event);    },    _updateSidebarWidth: function(width)    {        if (this.sidebarElement.offsetWidth <= 0) {            // The stylesheet hasn't loaded yet or the window is closed,            // so we can't calculate what is need. Return early.            return;        }        if (!("_currentSidebarWidth" in this))            this._currentSidebarWidth = this.sidebarElement.offsetWidth;        if (typeof width === "undefined")            width = this._currentSidebarWidth;        width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2);        this._currentSidebarWidth = width;        this.sidebarElement.style.width = width + "px";        this.profileViews.style.left = width + "px";        this.profileViewStatusBarItemsContainer.style.left = width + "px";        this.sidebarResizeElement.style.left = (width - 3) + "px";    }}WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype;WebInspector.ProfileSidebarTreeElement = function(profile){    this.profile = profile;    if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)        this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);    WebInspector.SidebarTreeElement.call(this, "profile-sidebar-tree-item", "", "", profile, false);    this.refreshTitles();}WebInspector.ProfileSidebarTreeElement.prototype = {    onselect: function()    {        WebInspector.panels.profiles.showProfile(this.profile);    },    get mainTitle()    {        if (this._mainTitle)            return this._mainTitle;        if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)            return WebInspector.UIString("Profile %d", this._profileNumber);        return this.profile.title;    },    set mainTitle(x)    {        this._mainTitle = x;        this.refreshTitles();    },    get subtitle()    {        // There is no subtitle.    },    set subtitle(x)    {        // Can't change subtitle.    },    set searchMatches(matches)    {        if (!matches) {            if (!this.bubbleElement)                return;            this.bubbleElement.removeStyleClass("search-matches");            this.bubbleText = "";            return;        }        this.bubbleText = matches;        this.bubbleElement.addStyleClass("search-matches");    }}WebInspector.ProfileSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle){    WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item", title, subtitle, null, true);}WebInspector.ProfileGroupSidebarTreeElement.prototype = {    onselect: function()    {        WebInspector.panels.profiles.showProfile(this.children[this.children.length - 1].profile);    }}WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -