Unverified Commit df811c6d authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove unused getRootRenderObject and getSelectedRenderObject service extensions (#124805)

These are currently unused and will not work in a multi-view environment where we will have multiple render trees.

Work towards https://github.com/flutter/flutter/issues/121573.
parent b6c7df44
...@@ -351,17 +351,6 @@ enum WidgetInspectorServiceExtensions { ...@@ -351,17 +351,6 @@ enum WidgetInspectorServiceExtensions {
/// extension is registered. /// extension is registered.
getRootWidget, getRootWidget,
/// Name of service extension that, when called, will return the
/// [DiagnosticsNode] data for the root [RenderObject].
///
/// See also:
///
/// * [WidgetInspectorService.getRootRenderObject], which returns a json
/// encoded String representation of this data.
/// * [WidgetInspectorService.initServiceExtensions], where the service
/// extension is registered.
getRootRenderObject,
/// Name of service extension that, when called, will return the /// Name of service extension that, when called, will return the
/// [DiagnosticsNode] data for the root [Element] of the summary tree, which /// [DiagnosticsNode] data for the root [Element] of the summary tree, which
/// only includes [Element]s that were created by user code. /// only includes [Element]s that were created by user code.
...@@ -403,17 +392,6 @@ enum WidgetInspectorServiceExtensions { ...@@ -403,17 +392,6 @@ enum WidgetInspectorServiceExtensions {
/// extension is registered. /// extension is registered.
getDetailsSubtree, getDetailsSubtree,
/// Name of service extension that, when called, will return the
/// [DiagnosticsNode] data for the currently selected [RenderObject].
///
/// See also:
///
/// * [WidgetInspectorService.getSelectedRenderObject], which returns a json
/// encoded String representation of this data.
/// * [WidgetInspectorService.initServiceExtensions], where the service
/// extension is registered.
getSelectedRenderObject,
/// Name of service extension that, when called, will return the /// Name of service extension that, when called, will return the
/// [DiagnosticsNode] data for the currently selected [Element]. /// [DiagnosticsNode] data for the currently selected [Element].
/// ///
......
...@@ -1153,10 +1153,6 @@ mixin WidgetInspectorService { ...@@ -1153,10 +1153,6 @@ mixin WidgetInspectorService {
name: WidgetInspectorServiceExtensions.getRootWidget.name, name: WidgetInspectorServiceExtensions.getRootWidget.name,
callback: _getRootWidget, callback: _getRootWidget,
); );
_registerObjectGroupServiceExtension(
name: WidgetInspectorServiceExtensions.getRootRenderObject.name,
callback: _getRootRenderObject,
);
_registerObjectGroupServiceExtension( _registerObjectGroupServiceExtension(
name: WidgetInspectorServiceExtensions.getRootWidgetSummaryTree.name, name: WidgetInspectorServiceExtensions.getRootWidgetSummaryTree.name,
callback: _getRootWidgetSummaryTree, callback: _getRootWidgetSummaryTree,
...@@ -1179,10 +1175,6 @@ mixin WidgetInspectorService { ...@@ -1179,10 +1175,6 @@ mixin WidgetInspectorService {
}; };
}, },
); );
_registerServiceExtensionWithArg(
name: WidgetInspectorServiceExtensions.getSelectedRenderObject.name,
callback: _getSelectedRenderObject,
);
_registerServiceExtensionWithArg( _registerServiceExtensionWithArg(
name: WidgetInspectorServiceExtensions.getSelectedWidget.name, name: WidgetInspectorServiceExtensions.getSelectedWidget.name,
callback: _getSelectedWidget, callback: _getSelectedWidget,
...@@ -1881,17 +1873,6 @@ mixin WidgetInspectorService { ...@@ -1881,17 +1873,6 @@ mixin WidgetInspectorService {
}); });
} }
/// Returns a JSON representation of the [DiagnosticsNode] for the root
/// [RenderObject].
@protected
String getRootRenderObject(String groupName) {
return _safeJsonEncode(_getRootRenderObject(groupName));
}
Map<String, Object?>? _getRootRenderObject(String groupName) {
return _nodeToJson(RendererBinding.instance.renderView.toDiagnosticsNode(), InspectorSerializationDelegate(groupName: groupName, service: this));
}
/// Returns a JSON representation of the subtree rooted at the /// Returns a JSON representation of the subtree rooted at the
/// [DiagnosticsNode] object that `diagnosticsNodeId` references providing /// [DiagnosticsNode] object that `diagnosticsNodeId` references providing
/// information needed for the details subtree view. /// information needed for the details subtree view.
...@@ -1932,23 +1913,6 @@ mixin WidgetInspectorService { ...@@ -1932,23 +1913,6 @@ mixin WidgetInspectorService {
); );
} }
/// Returns a [DiagnosticsNode] representing the currently selected
/// [RenderObject].
///
/// If the currently selected [RenderObject] is identical to the
/// [RenderObject] referenced by `previousSelectionId` then the previous
/// [DiagnosticsNode] is reused.
@protected
String getSelectedRenderObject(String previousSelectionId, String groupName) {
return _safeJsonEncode(_getSelectedRenderObject(previousSelectionId, groupName));
}
Map<String, Object?>? _getSelectedRenderObject(String? previousSelectionId, String groupName) {
final DiagnosticsNode? previousSelection = toObject(previousSelectionId) as DiagnosticsNode?;
final RenderObject? current = selection.current;
return _nodeToJson(current == previousSelection?.value ? previousSelection : current?.toDiagnosticsNode(), InspectorSerializationDelegate(groupName: groupName, service: this));
}
/// Returns a [DiagnosticsNode] representing the currently selected [Element]. /// Returns a [DiagnosticsNode] representing the currently selected [Element].
/// ///
/// If the currently selected [Element] is identical to the [Element] /// If the currently selected [Element] is identical to the [Element]
......
...@@ -154,7 +154,7 @@ void main() { ...@@ -154,7 +154,7 @@ void main() {
tearDownAll(() async { tearDownAll(() async {
// See widget_inspector_test.dart for tests of the ext.flutter.inspector // See widget_inspector_test.dart for tests of the ext.flutter.inspector
// service extensions included in this count. // service extensions included in this count.
int widgetInspectorExtensionCount = 22; int widgetInspectorExtensionCount = 20;
if (WidgetInspectorService.instance.isWidgetCreationTracked()) { if (WidgetInspectorService.instance.isWidgetCreationTracked()) {
// Some inspector extensions are only exposed if widget creation locations // Some inspector extensions are only exposed if widget creation locations
// are tracked. // are tracked.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment