Web Inspector: Add diagnostic logging for frontend feature usage
https://bugs.webkit.org/show_bug.cgi?id=203579
<rdar://problem/56717410>
Reviewed by Brian Burg.
.:
Original patch by Matt Baker <Matt Baker>.
- Source/cmake/OptionsMac.cmake:
- Source/cmake/WebKitFeatures.cmake:
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.
Source/JavaScriptCore:
Original patch by Matt Baker <Matt Baker>.
- Configurations/FeatureDefines.xcconfig:
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.
Source/WebCore:
Add InspectorFrontendHost
API for logging diagnostic events from the
Web Inspector UI. An event consists of a message string, such as "TabActivity"
or "SettingChanged", and a dictionary payload encoded as a JSON string.
Original patch by Matt Baker.
- inspector/InspectorFrontendHost.idl:
- inspector/InspectorFrontendHost.h:
- inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::supportsDiagnosticLogging): Added.
(WebCore::valuePayloadFromJSONValue): Added.
(WebCore::InspectorFrontendHost::logDiagnosticEvent): Added.
- inspector/InspectorFrontendClient.h:
(WebCore::InspectorFrontendClient::supportsDiagnosticLogging): Added.
(WebCore::InspectorFrontendClient::logDiagnosticEvent): Added.
- Configurations/FeatureDefines.xcconfig:
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.
Source/WebCore/PAL:
Original patch by Matt Baker <Matt Baker>.
- Configurations/FeatureDefines.xcconfig:
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.
Source/WebInspectorUI:
Add a DiagnosticController
class for reporting Web Inspector telemetry.
The controller initially measures a single "TabActivity" data point,
which logs the active tab during the specified time interval (one minute).
If the UI is not active during the time interval, no logging takes place.
The UI is considered to be active if mouse/keyboard interaction occurs
during the time interval, or the selected TabContentView
changes.
Original patch by Matt Baker <Matt Baker>.
- UserInterface/Controllers/DiagnosticController.js: Added.
(WI.DiagnosticController):
(WI.DiagnosticController.supportsDiagnosticLogging):
(WI.DiagnosticController.prototype.logDiagnosticMessage):
(WI.DiagnosticController.prototype._didInteractWithTabContent):
(WI.DiagnosticController.prototype._clearTabActivityTimeout):
(WI.DiagnosticController.prototype._beginTabActivityTimeout):
(WI.DiagnosticController.prototype._stopTrackingTabActivity):
(WI.DiagnosticController.prototype._handleWindowFocus):
(WI.DiagnosticController.prototype._handleWindowBlur):
(WI.DiagnosticController.prototype._handleWindowKeyDown):
(WI.DiagnosticController.prototype._handleWindowMouseDown):
(WI.DiagnosticController.prototype._handleTabBrowserSelectedTabContentViewDidChange):
- UserInterface/Main.html:
- UserInterface/Base/Main.js:
(WI.contentLoaded):
Source/WebKit:
This patch enables diagnostic logging for the Web Inspector web process
and adds the necessary InspectorFrontendClient
plumbing to WebInspectorUI
.
Original patch by Matt Baker <Matt Baker>.
- WebProcess/WebPage/WebInspectorUI.h:
- WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::supportsDiagnosticLogging): Added.
(WebKit::WebInspectorUI::logDagnosticEvent): Added.
- WebProcess/WebPage/RemoteWebInspectorUI.h:
- WebProcess/WebPage/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::supportsDiagnosticLogging): Added.
(WebKit::RemoteWebInspectorUI::logDiagnosticEvent): Added.
- UIProcess/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController configuration]):
Default to enabling diagnostic logging for the Web Inspector frontend window.
- Configurations/FeatureDefines.xcconfig:
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.
Source/WebKitLegacy/mac:
Original patch by Matt Baker <Matt Baker>.
- WebCoreSupport/WebInspectorClient.h:
- WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::supportsDiagnosticLogging): Added.
(WebInspectorFrontendClient::logDiagnosticEvent): Added.
- Configurations/FeatureDefines.xcconfig:
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.
Source/WTF:
Original patch by Matt Baker <Matt Baker>.
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.
Tools:
Original patch by Matt Baker <Matt Baker>.
- TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
Add ENABLE_INSPECTOR_TELEMETRY
, which is only enabled for macOS.