Skip to content

Commit

Permalink
feature: add style element count measure (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSiefke authored Nov 23, 2024
1 parent 24626fc commit 6dc76b3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as GetObjectCount from '../GetObjectCount/GetObjectCount.js'
import * as PrototypeExpression from '../PrototypeExpression/PrototypeExpression.js'

/**
*
* @param {any} session
* @returns {Promise<number>}
*/
export const getCanvasCount = async (session, objectGroup) => {
return GetObjectCount.getObjectCount(session, PrototypeExpression.StyleElement, objectGroup)
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const SetSize = 'setSize'
export const SetTimeout = 'setTimeout'
export const StringCount = 'stringCount'
export const StringDifference = 'stringDifference'
export const StyleElementCount = 'styleElementCount'
export const UserStringCount = 'userStringCount'
export const WeakMapCount = 'weakMapCount'
export const WeakSetCount = 'weakSetCount'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as CompareCount from '../CompareCount/CompareCount.js'
import * as GetStyleElementCount from '../GetStyleElementCount/GetStyleElementCount.js'
import * as IsLeakCount from '../IsLeakCount/IsLeakCount.js'
import * as MeasureId from '../MeasureId/MeasureId.js'
import * as ObjectGroupId from '../ObjectGroupId/ObjectGroupId.js'
import * as ReleaseObjectGroup from '../ReleaseObjectGroup/ReleaseObjectGroup.js'

export const id = MeasureId.StyleElementCount

export const create = (session) => {
const objectGroup = ObjectGroupId.create()
return [session, objectGroup]
}

export const start = (session, objectGroup) => {
return GetStyleElementCount.getCanvasCount(session, objectGroup)
}

export const stop = async (session, objectGroup) => {
const result = await GetStyleElementCount.getCanvasCount(session, objectGroup)
return result
}

export const releaseResources = async (session, objectGroup) => {
await ReleaseObjectGroup.releaseObjectGroup(session, objectGroup)
}

export const compare = CompareCount.compareCount

export const isLeak = IsLeakCount.isLeakCount
1 change: 1 addition & 0 deletions packages/memory-leak-finder/src/parts/Measures/Measures.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export * as MeasureSetSize from '../MeasureSetSize/MeasureSetSize.js'
export * as MeasureSetTimeout from '../MeasureSetTimeout/MeasureSetTimeout.js'
export * as MeasureStringCount from '../MeasureStringCount/MeasureStringCount.js'
export * as MeasureStringDifference from '../MeasureStringDifference/MeasureStringDifference.js'
export * as MeasureStyleElementCount from '../MeasureStyleElementCount/MeasureStyleElementCount.js'
export * as MeasureUserStringCount from '../MeasureUserStringCount/MeasureUserStringCount.js'
export * as MeasureWeakMapCount from '../MeasureWeakMapCount/MeasureWeakMapCount.js'
export * as MeasureWeakSetCount from '../MeasureWeakSetCount/MeasureWeakSetCount.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export const Promise = 'Promise.prototype'
export const Regex = 'RegExp.prototype'
export const ResizeObserver = 'ResizeObserver.prototype'
export const Set = 'Set.prototype'
export const StyleElement = 'HTMLStyleElement.prototype'
export const WeakMap = 'WeakMap.prototype'
export const WeakSet = 'WeakSet.prototype'

0 comments on commit 6dc76b3

Please sign in to comment.