Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (248535 => 248536)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-08-12 18:45:13 UTC (rev 248536)
@@ -1,3 +1,29 @@
+2019-08-09 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Better organize manager / observer API groups
+ https://bugs.webkit.org/show_bug.cgi?id=200594
+
+ Reviewed by Devin Rousso.
+
+ * UserInterface/Controllers/DebuggerManager.js:
+ (WI.DebuggerManager.prototype.globalObjectCleared):
+ (WI.DebuggerManager.prototype.reset): Deleted.
+ Renamed.
+
+ * UserInterface/Protocol/DebuggerObserver.js:
+ (WI.DebuggerObserver.prototype.globalObjectCleared):
+
+ * UserInterface/Controllers/CSSManager.js:
+ * UserInterface/Controllers/CanvasManager.js:
+ * UserInterface/Controllers/ConsoleManager.js:
+ * UserInterface/Controllers/DOMManager.js:
+ * UserInterface/Controllers/DOMStorageManager.js:
+ * UserInterface/Controllers/LayerTreeManager.js:
+ * UserInterface/Controllers/NetworkManager.js:
+ * UserInterface/Controllers/TargetManager.js:
+ * UserInterface/Controllers/TimelineManager.js:
+ * UserInterface/Controllers/WorkerManager.js:
+
2019-08-10 Devin Rousso <[email protected]>
Web Inspector: REGRESSION(r248454): WK1 inspector frontend client doesn't queue messages to the frontend before it's loaded
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -401,10 +401,30 @@
this.mediaQueryResultChanged();
}
+ get modifiedStyles()
+ {
+ return Array.from(this._modifiedStyles.values());
+ }
+
+ addModifiedStyle(style)
+ {
+ this._modifiedStyles.set(style.stringId, style);
+ }
+
+ getModifiedStyle(style)
+ {
+ return this._modifiedStyles.get(style.stringId);
+ }
+
+ removeModifiedStyle(style)
+ {
+ this._modifiedStyles.delete(style.stringId);
+ }
+
+ // PageObserver
+
defaultAppearanceDidChange(protocolName)
{
- // Called from WI.PageObserver.
-
let appearance = null;
switch (protocolName) {
@@ -428,32 +448,10 @@
this.dispatchEventToListeners(WI.CSSManager.Event.DefaultAppearanceDidChange, {appearance});
}
- get modifiedStyles()
- {
- return Array.from(this._modifiedStyles.values());
- }
+ // CSSObserver
- addModifiedStyle(style)
- {
- this._modifiedStyles.set(style.stringId, style);
- }
-
- getModifiedStyle(style)
- {
- return this._modifiedStyles.get(style.stringId);
- }
-
- removeModifiedStyle(style)
- {
- this._modifiedStyles.delete(style.stringId);
- }
-
- // Protected
-
mediaQueryResultChanged()
{
- // Called from WI.CSSObserver.
-
for (var key in this._nodeStylesMap)
this._nodeStylesMap[key].mediaQueryResultDidChange();
}
@@ -460,7 +458,6 @@
styleSheetChanged(styleSheetIdentifier)
{
- // Called from WI.CSSObserver.
var styleSheet = this.styleSheetForIdentifier(styleSheetIdentifier);
console.assert(styleSheet);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -152,10 +152,10 @@
WI.settings.canvasRecordingAutoCaptureFrameCount.value = count;
}
+ // CanvasObserver
+
canvasAdded(canvasPayload)
{
- // Called from WI.CanvasObserver.
-
console.assert(!this._canvasIdentifierMap.has(canvasPayload.canvasId), `Canvas already exists with id ${canvasPayload.canvasId}.`);
let canvas = WI.Canvas.fromPayload(canvasPayload);
@@ -166,8 +166,6 @@
canvasRemoved(canvasIdentifier)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.take(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -178,8 +176,6 @@
canvasMemoryChanged(canvasIdentifier, memoryCost)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -190,8 +186,6 @@
cssCanvasClientNodesChanged(canvasIdentifier)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -202,8 +196,6 @@
recordingStarted(canvasIdentifier, initiator)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -214,8 +206,6 @@
recordingProgress(canvasIdentifier, framesPayload, bufferUsed)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -226,8 +216,6 @@
recordingFinished(canvasIdentifier, recordingPayload)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -238,8 +226,6 @@
extensionEnabled(canvasIdentifier, extension)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -250,8 +236,6 @@
programCreated(canvasIdentifier, programIdentifier)
{
- // Called from WI.CanvasObserver.
-
let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
console.assert(canvas);
if (!canvas)
@@ -267,8 +251,6 @@
programDeleted(programIdentifier)
{
- // Called from WI.CanvasObserver.
-
let program = this._shaderProgramIdentifierMap.take(programIdentifier);
console.assert(program);
if (!program)
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -85,10 +85,10 @@
this._remoteObjectsToRelease.add(remoteObject);
}
+ // ConsoleObserver
+
messageWasAdded(target, source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, requestId)
{
- // Called from WI.ConsoleObserver.
-
// FIXME: Get a request from request ID.
if (parameters)
@@ -108,8 +108,6 @@
messagesCleared()
{
- // Called from WI.ConsoleObserver.
-
if (this._remoteObjectsToRelease) {
for (let remoteObject of this._remoteObjectsToRelease)
remoteObject.release();
@@ -134,25 +132,8 @@
}
}
- _delayedMessagesCleared()
- {
- if (this._isNewPageOrReload) {
- this._isNewPageOrReload = false;
-
- if (!WI.settings.clearLogOnNavigate.value)
- return;
- }
-
- this._issues = [];
-
- // A console.clear() or command line clear() happened.
- this.dispatchEventToListeners(WI.ConsoleManager.Event.Cleared);
- }
-
messageRepeatCountUpdated(count)
{
- // Called from WI.ConsoleObserver.
-
this.dispatchEventToListeners(WI.ConsoleManager.Event.PreviousMessageRepeatCountUpdated, {count});
}
@@ -188,6 +169,21 @@
// Private
+ _delayedMessagesCleared()
+ {
+ if (this._isNewPageOrReload) {
+ this._isNewPageOrReload = false;
+
+ if (!WI.settings.clearLogOnNavigate.value)
+ return;
+ }
+
+ this._issues = [];
+
+ // A console.clear() or command line clear() happened.
+ this.dispatchEventToListeners(WI.ConsoleManager.Event.Cleared);
+ }
+
_mainResourceDidChange(event)
{
console.assert(event.target instanceof WI.Frame);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -145,10 +145,10 @@
this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent, path), callback);
}
+ // DOMObserver
+
didAddEventListener(nodeId)
{
- // Called from WI.DOMObserver.
-
let node = this._idToDOMNode[nodeId];
if (!node)
return;
@@ -158,8 +158,6 @@
willRemoveEventListener(nodeId)
{
- // Called from WI.DOMObserver.
-
let node = this._idToDOMNode[nodeId];
if (!node)
return;
@@ -169,8 +167,6 @@
didFireEvent(nodeId, eventName, timestamp, data)
{
- // Called from WI.DOMObserver.
-
let node = this._idToDOMNode[nodeId];
if (!node)
return;
@@ -180,8 +176,6 @@
powerEfficientPlaybackStateChanged(nodeId, timestamp, isPowerEfficient)
{
- // Called from WI.DOMObserver.
-
let node = this._idToDOMNode[nodeId];
if (!node)
return;
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -140,10 +140,10 @@
domStorage.itemUpdated(key, oldValue, value);
}
+ // InspectorObserver
+
inspectDOMStorage(id)
{
- // Called from WI.InspectorObserver.
-
console.assert(this._enabled);
var domStorage = this._domStorageForIdentifier(id);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -548,12 +548,10 @@
return this._nextBreakpointActionIdentifier++;
}
- // Protected (Called from WI.DebuggerObserver)
+ // DebuggerObserver
breakpointResolved(target, breakpointIdentifier, location)
{
- // Called from WI.DebuggerObserver.
-
let breakpoint = this._breakpointIdMap.get(breakpointIdentifier);
console.assert(breakpoint);
if (!breakpoint)
@@ -569,10 +567,8 @@
breakpoint.resolved = true;
}
- reset()
+ globalObjectCleared()
{
- // Called from WI.DebuggerObserver.
-
let wasPaused = this.paused;
WI.Script.resetUniqueDisplayNameNumbers();
@@ -600,8 +596,6 @@
debuggerDidPause(target, callFramesPayload, reason, data, asyncStackTracePayload)
{
- // Called from WI.DebuggerObserver.
-
if (this._delayedResumeTimeout) {
clearTimeout(this._delayedResumeTimeout);
this._delayedResumeTimeout = undefined;
@@ -674,8 +668,6 @@
debuggerDidResume(target)
{
- // Called from WI.DebuggerObserver.
-
// COMPATIBILITY (iOS 10): Debugger.resumed event was ambiguous. When stepping
// we would receive a Debugger.resumed and we would not know if it really meant
// the backend resumed or would pause again due to a step. Legacy backends wait
@@ -692,15 +684,11 @@
playBreakpointActionSound(breakpointActionIdentifier)
{
- // Called from WI.DebuggerObserver.
-
InspectorFrontendHost.beep();
}
scriptDidParse(target, scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL)
{
- // Called from WI.DebuggerObserver.
-
// Don't add the script again if it is already known.
let targetData = this.dataForTarget(target);
let existingScript = targetData.scriptForIdentifier(scriptIdentifier);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -90,6 +90,8 @@
});
}
+ // LayerTreeObserver
+
layerTreeDidChange()
{
this.dispatchEventToListeners(WI.LayerTreeManager.Event.LayerTreeDidChange);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -168,10 +168,80 @@
loadAndParseSourceMap();
}
+ localResourceForURL(url)
+ {
+ return this._localResourcesMap.get(url);
+ }
+
+ resourceForURL(url)
+ {
+ if (!this._mainFrame)
+ return null;
+
+ if (this._mainFrame.mainResource.url ="" url)
+ return this._mainFrame.mainResource;
+
+ return this._mainFrame.resourceForURL(url, true);
+ }
+
+ adoptOrphanedResourcesForTarget(target)
+ {
+ let resources = this._orphanedResources.take(target.identifier);
+ if (!resources)
+ return;
+
+ for (let resource of resources)
+ target.adoptResource(resource);
+ }
+
+ processHAR({json, error})
+ {
+ if (error) {
+ WI.NetworkManager.synthesizeImportError(error);
+ return null;
+ }
+
+ if (typeof json !== "object" || json === null) {
+ WI.NetworkManager.synthesizeImportError(WI.UIString("invalid JSON"));
+ return null;
+ }
+
+ if (typeof json.log !== "object" || typeof json.log.version !== "string") {
+ WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
+ return null;
+ }
+
+ if (json.log.version !== "1.2") {
+ WI.NetworkManager.synthesizeImportError(WI.UIString("unsupported HAR version"));
+ return null;
+ }
+
+ if (!Array.isArray(json.log.entries) || !Array.isArray(json.log.pages) || !json.log.pages[0] || !json.log.pages[0].startedDateTime) {
+ WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
+ return null;
+ }
+
+ let mainResourceSentWalltime = WI.HARBuilder.dateFromHARDate(json.log.pages[0].startedDateTime) / 1000;
+ if (isNaN(mainResourceSentWalltime)) {
+ WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
+ return null;
+ }
+
+ let localResources = [];
+
+ for (let entry of json.log.entries) {
+ let localResource = WI.LocalResource.fromHAREntry(entry, mainResourceSentWalltime);
+ this._localResourcesMap.set(localResource.url, localResource);
+ localResources.push(localResource);
+ }
+
+ return localResources;
+ }
+
+ // PageObserver
+
frameDidNavigate(framePayload)
{
- // Called from WI.PageObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -244,8 +314,6 @@
frameDidDetach(frameId)
{
- // Called from WI.PageObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -272,10 +340,10 @@
this._mainFrameDidChange(oldMainFrame);
}
+ // NetworkObserver
+
resourceRequestWillBeSent(requestIdentifier, frameIdentifier, loaderIdentifier, request, type, redirectResponse, timestamp, walltime, initiator, targetId)
{
- // Called from WI.NetworkObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -417,8 +485,6 @@
markResourceRequestAsServedFromMemoryCache(requestIdentifier)
{
- // Called from WI.NetworkObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -436,8 +502,6 @@
resourceRequestWasServedFromMemoryCache(requestIdentifier, frameIdentifier, loaderIdentifier, cachedResourcePayload, timestamp, initiator)
{
- // Called from WI.NetworkObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -475,8 +539,6 @@
resourceRequestDidReceiveResponse(requestIdentifier, frameIdentifier, loaderIdentifier, type, response, timestamp)
{
- // Called from WI.NetworkObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -525,8 +587,6 @@
resourceRequestDidReceiveData(requestIdentifier, dataLength, encodedDataLength, timestamp)
{
- // Called from WI.NetworkObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -548,8 +608,6 @@
resourceRequestDidFinishLoading(requestIdentifier, timestamp, sourceMapURL, metrics)
{
- // Called from WI.NetworkObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -575,8 +633,6 @@
resourceRequestDidFailLoading(requestIdentifier, canceled, timestamp, errorText)
{
- // Called from WI.NetworkObserver.
-
// Ignore this while waiting for the whole frame/resource tree.
if (this._waitingForMainFrameResourceTreePayload)
return;
@@ -597,10 +653,10 @@
this._resourceRequestIdentifierMap.delete(requestIdentifier);
}
+ // RuntimeObserver
+
executionContextCreated(contextPayload)
{
- // Called from WI.RuntimeObserver.
-
let frame = this.frameForIdentifier(contextPayload.frameId);
console.assert(frame);
if (!frame)
@@ -612,76 +668,6 @@
frame.addExecutionContext(executionContext);
}
- localResourceForURL(url)
- {
- return this._localResourcesMap.get(url);
- }
-
- resourceForURL(url)
- {
- if (!this._mainFrame)
- return null;
-
- if (this._mainFrame.mainResource.url ="" url)
- return this._mainFrame.mainResource;
-
- return this._mainFrame.resourceForURL(url, true);
- }
-
- adoptOrphanedResourcesForTarget(target)
- {
- let resources = this._orphanedResources.take(target.identifier);
- if (!resources)
- return;
-
- for (let resource of resources)
- target.adoptResource(resource);
- }
-
- processHAR({json, error})
- {
- if (error) {
- WI.NetworkManager.synthesizeImportError(error);
- return null;
- }
-
- if (typeof json !== "object" || json === null) {
- WI.NetworkManager.synthesizeImportError(WI.UIString("invalid JSON"));
- return null;
- }
-
- if (typeof json.log !== "object" || typeof json.log.version !== "string") {
- WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
- return null;
- }
-
- if (json.log.version !== "1.2") {
- WI.NetworkManager.synthesizeImportError(WI.UIString("unsupported HAR version"));
- return null;
- }
-
- if (!Array.isArray(json.log.entries) || !Array.isArray(json.log.pages) || !json.log.pages[0] || !json.log.pages[0].startedDateTime) {
- WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
- return null;
- }
-
- let mainResourceSentWalltime = WI.HARBuilder.dateFromHARDate(json.log.pages[0].startedDateTime) / 1000;
- if (isNaN(mainResourceSentWalltime)) {
- WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
- return null;
- }
-
- let localResources = [];
-
- for (let entry of json.log.entries) {
- let localResource = WI.LocalResource.fromHAREntry(entry, mainResourceSentWalltime);
- this._localResourcesMap.set(localResource.url, localResource);
- localResources.push(localResource);
- }
-
- return localResources;
- }
-
// Private
_addNewResourceToFrameOrTarget(url, frameIdentifier, resourceOptions = {}, frameOptions = {})
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -62,45 +62,6 @@
return null;
}
- targetCreated(targetInfo)
- {
- // Called from WI.TargetObserver.
-
- // FIXME: Eliminate this once the local inspector is configured to use
- // the Multiplexing code path. Then we can perform this immediately
- // in `WI.loaded` if a TargetAgent exists.
- if (this._targets.size === 0)
- this.createMultiplexingBackendTarget(targetInfo);
-
- let connection = new InspectorBackend.TargetConnection(targetInfo.targetId);
- let target = this._createTarget(targetInfo, connection);
- this._checkAndHandlePageTargetTransition(target);
- target.initialize();
-
- this.addTarget(target);
- }
-
- targetDestroyed(targetId)
- {
- // Called from WI.TargetObserver.
-
- let target = this._targets.get(targetId);
- this._checkAndHandlePageTargetTermination(target);
- this.removeTarget(target);
- }
-
- dispatchMessageFromTarget(targetId, message)
- {
- // Called from WI.TargetObserver.
-
- let target = this._targets.get(targetId);
- console.assert(target);
- if (!target)
- return;
-
- target.connection.dispatch(message);
- }
-
addTarget(target)
{
console.assert(target);
@@ -147,6 +108,41 @@
this.addTarget(target);
}
+ // TargetObserver
+
+ targetCreated(targetInfo)
+ {
+ // FIXME: Eliminate this once the local inspector is configured to use
+ // the Multiplexing code path. Then we can perform this immediately
+ // in `WI.loaded` if a TargetAgent exists.
+ if (this._targets.size === 0)
+ this.createMultiplexingBackendTarget(targetInfo);
+
+ let connection = new InspectorBackend.TargetConnection(targetInfo.targetId);
+ let target = this._createTarget(targetInfo, connection);
+ this._checkAndHandlePageTargetTransition(target);
+ target.initialize();
+
+ this.addTarget(target);
+ }
+
+ targetDestroyed(targetId)
+ {
+ let target = this._targets.get(targetId);
+ this._checkAndHandlePageTargetTermination(target);
+ this.removeTarget(target);
+ }
+
+ dispatchMessageFromTarget(targetId, message)
+ {
+ let target = this._targets.get(targetId);
+ console.assert(target);
+ if (!target)
+ return;
+
+ target.connection.dispatch(message);
+ }
+
// Private
_createTarget(targetInfo, connection)
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -379,6 +379,8 @@
return this._scriptProfilerRecords !== null;
}
+ // ConsoleObserver
+
heapSnapshotAdded(timestamp, snapshot)
{
if (!this._enabled)
@@ -603,6 +605,102 @@
this.capturingStopped(timestamp);
}
+ // ScriptProfilerObserver
+
+ scriptProfilerTrackingStarted(timestamp)
+ {
+ this._scriptProfilerRecords = [];
+
+ this.capturingStarted(timestamp);
+ }
+
+ scriptProfilerTrackingUpdated(event)
+ {
+ if (!this._enabled)
+ return;
+
+ let {startTime, endTime, type} = event;
+ let scriptRecordType = this._scriptProfilerTypeToScriptTimelineRecordType(type);
+ let record = new WI.ScriptTimelineRecord(scriptRecordType, startTime, endTime, null, null, null, null);
+ record.__scriptProfilerType = type;
+ this._scriptProfilerRecords.push(record);
+
+ // "Other" events, generated by Web content, will have wrapping Timeline records
+ // and need to be merged. Non-Other events, generated purely by the _javascript_
+ // engine or outside of the page via APIs, will not have wrapping Timeline
+ // records, so these records can just be added right now.
+ if (type !== ScriptProfilerAgent.EventType.Other)
+ this._addRecord(record);
+ }
+
+ scriptProfilerTrackingCompleted(timestamp, samples)
+ {
+ if (this._enabled) {
+ console.assert(!this._webTimelineScriptRecordsExpectingScriptProfilerEvents || this._scriptProfilerRecords.length >= this._webTimelineScriptRecordsExpectingScriptProfilerEvents.length);
+
+ if (samples) {
+ let {stackTraces} = samples;
+ let topDownCallingContextTree = this._activeRecording.topDownCallingContextTree;
+
+ // Calculate a per-sample duration.
+ let timestampIndex = 0;
+ let timestampCount = stackTraces.length;
+ let sampleDurations = new Array(timestampCount);
+ let sampleDurationIndex = 0;
+ const defaultDuration = 1 / 1000; // 1ms.
+ for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
+ let record = this._scriptProfilerRecords[i];
+
+ // Use a default duration for timestamps recorded outside of ScriptProfiler events.
+ while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.startTime) {
+ sampleDurations[sampleDurationIndex++] = defaultDuration;
+ timestampIndex++;
+ }
+
+ // Average the duration per sample across all samples during the record.
+ let samplesInRecord = 0;
+ while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.endTime) {
+ timestampIndex++;
+ samplesInRecord++;
+ }
+ if (samplesInRecord) {
+ let averageDuration = (record.endTime - record.startTime) / samplesInRecord;
+ sampleDurations.fill(averageDuration, sampleDurationIndex, sampleDurationIndex + samplesInRecord);
+ sampleDurationIndex += samplesInRecord;
+ }
+ }
+
+ // Use a default duration for timestamps recorded outside of ScriptProfiler events.
+ if (timestampIndex < timestampCount)
+ sampleDurations.fill(defaultDuration, sampleDurationIndex);
+
+ this._activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
+
+ // FIXME: This transformation should not be needed after introducing ProfileView.
+ // Once we eliminate ProfileNodeTreeElements and ProfileNodeDataGridNodes.
+ // <https://webkit.org/b/154973> Web Inspector: Timelines UI redesign: Remove TimelineSidebarPanel
+ for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
+ let record = this._scriptProfilerRecords[i];
+ record.profilePayload = topDownCallingContextTree.toCPUProfilePayload(record.startTime, record.endTime);
+ }
+ }
+
+ // Associate the ScriptProfiler created records with Web Timeline records.
+ // Filter out the already added ScriptProfiler events which should not have been wrapped.
+ if (WI.sharedApp.debuggableType !== WI.DebuggableType._javascript_) {
+ this._scriptProfilerRecords = this._scriptProfilerRecords.filter((x) => x.__scriptProfilerType === ScriptProfilerAgent.EventType.Other);
+ this._mergeScriptProfileRecords();
+ }
+
+ this._scriptProfilerRecords = null;
+
+ let timeline = this._activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
+ timeline.refresh();
+ }
+
+ this.capturingStopped(timestamp);
+ }
+
// MemoryObserver
memoryTrackingStarted(timestamp)
@@ -1130,100 +1228,6 @@
}
}
- scriptProfilerTrackingStarted(timestamp)
- {
- this._scriptProfilerRecords = [];
-
- this.capturingStarted(timestamp);
- }
-
- scriptProfilerTrackingUpdated(event)
- {
- if (!this._enabled)
- return;
-
- let {startTime, endTime, type} = event;
- let scriptRecordType = this._scriptProfilerTypeToScriptTimelineRecordType(type);
- let record = new WI.ScriptTimelineRecord(scriptRecordType, startTime, endTime, null, null, null, null);
- record.__scriptProfilerType = type;
- this._scriptProfilerRecords.push(record);
-
- // "Other" events, generated by Web content, will have wrapping Timeline records
- // and need to be merged. Non-Other events, generated purely by the _javascript_
- // engine or outside of the page via APIs, will not have wrapping Timeline
- // records, so these records can just be added right now.
- if (type !== ScriptProfilerAgent.EventType.Other)
- this._addRecord(record);
- }
-
- scriptProfilerTrackingCompleted(timestamp, samples)
- {
- if (this._enabled) {
- console.assert(!this._webTimelineScriptRecordsExpectingScriptProfilerEvents || this._scriptProfilerRecords.length >= this._webTimelineScriptRecordsExpectingScriptProfilerEvents.length);
-
- if (samples) {
- let {stackTraces} = samples;
- let topDownCallingContextTree = this._activeRecording.topDownCallingContextTree;
-
- // Calculate a per-sample duration.
- let timestampIndex = 0;
- let timestampCount = stackTraces.length;
- let sampleDurations = new Array(timestampCount);
- let sampleDurationIndex = 0;
- const defaultDuration = 1 / 1000; // 1ms.
- for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
- let record = this._scriptProfilerRecords[i];
-
- // Use a default duration for timestamps recorded outside of ScriptProfiler events.
- while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.startTime) {
- sampleDurations[sampleDurationIndex++] = defaultDuration;
- timestampIndex++;
- }
-
- // Average the duration per sample across all samples during the record.
- let samplesInRecord = 0;
- while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.endTime) {
- timestampIndex++;
- samplesInRecord++;
- }
- if (samplesInRecord) {
- let averageDuration = (record.endTime - record.startTime) / samplesInRecord;
- sampleDurations.fill(averageDuration, sampleDurationIndex, sampleDurationIndex + samplesInRecord);
- sampleDurationIndex += samplesInRecord;
- }
- }
-
- // Use a default duration for timestamps recorded outside of ScriptProfiler events.
- if (timestampIndex < timestampCount)
- sampleDurations.fill(defaultDuration, sampleDurationIndex);
-
- this._activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
-
- // FIXME: This transformation should not be needed after introducing ProfileView.
- // Once we eliminate ProfileNodeTreeElements and ProfileNodeDataGridNodes.
- // <https://webkit.org/b/154973> Web Inspector: Timelines UI redesign: Remove TimelineSidebarPanel
- for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
- let record = this._scriptProfilerRecords[i];
- record.profilePayload = topDownCallingContextTree.toCPUProfilePayload(record.startTime, record.endTime);
- }
- }
-
- // Associate the ScriptProfiler created records with Web Timeline records.
- // Filter out the already added ScriptProfiler events which should not have been wrapped.
- if (WI.sharedApp.debuggableType !== WI.DebuggableType._javascript_) {
- this._scriptProfilerRecords = this._scriptProfilerRecords.filter((x) => x.__scriptProfilerType === ScriptProfilerAgent.EventType.Other);
- this._mergeScriptProfileRecords();
- }
-
- this._scriptProfilerRecords = null;
-
- let timeline = this._activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
- timeline.refresh();
- }
-
- this.capturingStopped(timestamp);
- }
-
_mergeScriptProfileRecords()
{
let nextRecord = function(list) { return list.shift() || null; };
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -40,12 +40,10 @@
target.WorkerAgent.enable();
}
- // Public
+ // WorkerObserver
workerCreated(workerId, url)
{
- // Called from WI.WorkerObserver.
-
let connection = new InspectorBackend.WorkerConnection(workerId);
let workerTarget = new WI.WorkerTarget(workerId, url, connection);
workerTarget.initialize();
@@ -61,8 +59,6 @@
workerTerminated(workerId)
{
- // Called from WI.WorkerObserver.
-
let connection = this._connections.take(workerId);
WI.targetManager.removeTarget(connection.target);
@@ -70,8 +66,6 @@
dispatchMessageFromWorker(workerId, message)
{
- // Called from WI.WorkerObserver.
-
let connection = this._connections.get(workerId);
console.assert(connection);
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js (248535 => 248536)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js 2019-08-12 18:45:13 UTC (rev 248536)
@@ -34,7 +34,7 @@
globalObjectCleared()
{
- WI.debuggerManager.reset();
+ WI.debuggerManager.globalObjectCleared();
}
scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL, isModule)