Bug 1560942 - Fix perf regression from Event listener breakpoints. r=loganfsmyth

Differential Revision: https://phabricator.services.mozilla.com/D36826

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jason Laster 2019-07-10 00:17:20 +00:00
Родитель 32c93bfb91
Коммит 6c4ef459cd
6 изменённых файлов: 27 добавлений и 25 удалений

Просмотреть файл

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
declare module "devtools-wasm-dwarf" {
declare module.exports: any;
}

Просмотреть файл

@ -6,8 +6,6 @@
import { uniq, remove } from "lodash";
import { asyncStore } from "../utils/prefs";
import {
getActiveEventListeners,
getEventListenerExpanded,
@ -17,13 +15,6 @@ import type { ThunkArgs } from "./types";
async function updateBreakpoints(dispatch, client, newEvents: string[]) {
dispatch({ type: "UPDATE_EVENT_LISTENERS", active: newEvents });
const current = await asyncStore.eventListenerBreakpoints;
asyncStore.eventListenerBreakpoints = {
...current,
active: newEvents,
};
await client.setEventListenerBreakpoints(newEvents);
}
@ -32,12 +23,6 @@ async function updateExpanded(dispatch, newExpanded: string[]) {
type: "UPDATE_EVENT_LISTENER_EXPANDED",
expanded: newExpanded,
});
const current = await asyncStore.eventListenerBreakpoints;
asyncStore.eventListenerBreakpoints = {
...current,
expanded: newExpanded,
};
}
export function addEventListenerBreakpoints(eventsToAdd: string[]) {

Просмотреть файл

@ -12,11 +12,11 @@ import type {
EventListenerExpandedList,
} from "../actions/types";
export type EventListenersState = {
active: EventListenerActiveList,
categories: EventListenerCategoryList,
expanded: EventListenerExpandedList,
};
export type EventListenersState = {|
+active: EventListenerActiveList,
+categories: EventListenerCategoryList,
+expanded: EventListenerExpandedList,
|};
export function initialEventListenerState(): EventListenersState {
return {
@ -46,19 +46,19 @@ function update(
}
export function getActiveEventListeners(state: State): EventListenerActiveList {
return state.eventListenerBreakpoints.active || [];
return state.eventListenerBreakpoints.active;
}
export function getEventListenerBreakpointTypes(
state: State
): EventListenerCategoryList {
return state.eventListenerBreakpoints.categories || [];
return state.eventListenerBreakpoints.categories;
}
export function getEventListenerExpanded(
state: State
): EventListenerExpandedList {
return state.eventListenerBreakpoints.expanded || [];
return state.eventListenerBreakpoints.expanded;
}
export default update;

Просмотреть файл

@ -117,11 +117,14 @@ export function bootstrapApp(store: any) {
let currentPendingBreakpoints;
let currentXHRBreakpoints;
let currentEventBreakpoints;
function updatePrefs(state: any) {
const previousPendingBreakpoints = currentPendingBreakpoints;
const previousXHRBreakpoints = currentXHRBreakpoints;
const previousEventBreakpoints = currentEventBreakpoints;
currentPendingBreakpoints = selectors.getPendingBreakpoints(state);
currentXHRBreakpoints = selectors.getXHRBreakpoints(state);
currentEventBreakpoints = state.eventListenerBreakpoints;
if (
previousPendingBreakpoints &&
@ -130,6 +133,13 @@ function updatePrefs(state: any) {
asyncStore.pendingBreakpoints = currentPendingBreakpoints;
}
if (
previousEventBreakpoints &&
previousEventBreakpoints !== currentEventBreakpoints
) {
asyncStore.eventListenerBreakpoints = currentEventBreakpoints;
}
if (currentXHRBreakpoints !== previousXHRBreakpoints) {
asyncStore.xhrBreakpoints = currentXHRBreakpoints;
}

Просмотреть файл

@ -12,7 +12,7 @@ import { asyncStoreHelper } from "./asyncStoreHelper";
// Schema version to bump when the async store format has changed incompatibly
// and old stores should be cleared. This needs to match the prefs schema
// version in devtools/client/preferences/debugger.js.
const prefsSchemaVersion = "1.0.10";
const prefsSchemaVersion = "1.0.11";
const pref = Services.pref;
if (isDevelopment()) {

Просмотреть файл

@ -20,7 +20,7 @@ pref("devtools.debugger.workers", false);
// The default Debugger UI settings
// This schema version needs to match that in devtools/client/debugger/src/utils/prefs.js.
pref("devtools.debugger.prefs-schema-version", "1.0.10");
pref("devtools.debugger.prefs-schema-version", "1.0.11");
pref("devtools.debugger.ui.panes-workers-and-sources-width", 200);
pref("devtools.debugger.ui.panes-instruments-width", 300);
pref("devtools.debugger.ui.panes-visible-on-startup", false);