Skip to content

Commit

Permalink
Enable eval and browse. (#5542)
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c committed Mar 29, 2023
1 parent b70653b commit db0c403
Show file tree
Hide file tree
Showing 21 changed files with 12 additions and 34 deletions.
Expand Up @@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
import '../../../../../shared/analytics/analytics.dart' as ga;
import '../../../../../shared/analytics/constants.dart' as gac;
import '../../../../../shared/common_widgets.dart';
import '../../../../../shared/feature_flags.dart';
import '../../../../../shared/globals.dart';
import '../../../../../shared/primitives/utils.dart';
import '../../../../../shared/table/table.dart';
Expand Down Expand Up @@ -88,7 +87,7 @@ class _InstanceColumn extends ColumnData<DiffClassStats>
_InstanceColumn(this.dataPart, this.diffData)
: super(
columnTitle(dataPart),
fixedWidthPx: scaleByFontFactor(80.0),
fixedWidthPx: scaleByFontFactor(110.0),
alignment: ColumnAlignment.right,
);

Expand Down Expand Up @@ -144,7 +143,6 @@ class _InstanceColumn extends ColumnData<DiffClassStats>
bool isRowSelected = false,
VoidCallback? onPressed,
}) {
if (!FeatureFlags.evalAndBrowse) return null;
final objects = _instances(data);

if (dataPart == _DataPart.delta) {
Expand Down
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter/material.dart';

import '../../../../../shared/analytics/analytics.dart' as ga;
import '../../../../../shared/analytics/constants.dart' as gac;
import '../../../../../shared/feature_flags.dart';
import '../../../../../shared/globals.dart';
import '../../../../../shared/primitives/utils.dart';
import '../../../../../shared/table/table.dart';
Expand Down Expand Up @@ -80,7 +79,7 @@ class _InstanceColumn extends ColumnData<SingleClassStats>
: super(
'Instances',
titleTooltip: nonGcableInstancesColumnTooltip,
fixedWidthPx: scaleByFontFactor(90.0),
fixedWidthPx: scaleByFontFactor(110.0),
alignment: ColumnAlignment.right,
);

Expand All @@ -99,8 +98,6 @@ class _InstanceColumn extends ColumnData<SingleClassStats>
bool isRowSelected = false,
VoidCallback? onPressed,
}) {
if (!FeatureFlags.evalAndBrowse) return null;

return InstanceTableCell(
data.objects,
classData.heap,
Expand Down
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import '../../common_widgets.dart';
import '../../feature_flags.dart';
import '../../globals.dart';
import '../../theme.dart';
import '../console.dart';
Expand All @@ -22,7 +21,7 @@ class ConsolePaneHeader extends AreaPaneHeader {
title: const Text('Console'),
roundedTopBorder: true,
actions: [
if (FeatureFlags.evalAndBrowse) const ConsoleHelpLink(),
const ConsoleHelpLink(),
CopyToClipboardControl(
dataProvider: () =>
serviceManager.consoleService.stdio.value.join('\n'),
Expand Down
21 changes: 7 additions & 14 deletions packages/devtools_app/lib/src/shared/console/widgets/evaluate.dart
Expand Up @@ -12,7 +12,6 @@ import 'package:vm_service/vm_service.dart';

import '../../analytics/analytics.dart' as ga;
import '../../analytics/constants.dart' as gac;
import '../../feature_flags.dart';
import '../../globals.dart';
import '../../primitives/auto_dispose.dart';
import '../../theme.dart';
Expand Down Expand Up @@ -224,16 +223,12 @@ class ExpressionEvalFieldState extends State<ExpressionEvalField>
shouldRequestFocus: false,
clearFieldOnEscapeWhenOverlayHidden: true,
onSelection: _onSelection,
decoration: InputDecoration(
contentPadding: const EdgeInsets.all(denseSpacing),
border: const OutlineInputBorder(),
focusedBorder:
const OutlineInputBorder(borderSide: BorderSide.none),
enabledBorder:
const OutlineInputBorder(borderSide: BorderSide.none),
labelText: FeatureFlags.evalAndBrowse
? 'Eval. Enter "?" for help.'
: 'Eval',
decoration: const InputDecoration(
contentPadding: EdgeInsets.all(denseSpacing),
border: OutlineInputBorder(),
focusedBorder: OutlineInputBorder(borderSide: BorderSide.none),
enabledBorder: OutlineInputBorder(borderSide: BorderSide.none),
labelText: 'Eval. Enter "?" for help.',
),
overlayXPositionBuilder:
(String inputValue, TextStyle? inputStyle) {
Expand Down Expand Up @@ -316,7 +311,7 @@ class ExpressionEvalFieldState extends State<ExpressionEvalField>

if (expressionText.isEmpty) return;

if (FeatureFlags.evalAndBrowse && expressionText.trim() == '?') {
if (expressionText.trim() == '?') {
ga.select(gac.console, gac.ConsoleEvent.helpInline);
unawaited(
showDialog(
Expand Down Expand Up @@ -436,8 +431,6 @@ class ExpressionEvalFieldState extends State<ExpressionEvalField>
///
/// Returns true if the text was parsed as assignment.
bool _tryProcessAssignment(String expressionText) {
if (!FeatureFlags.evalAndBrowse) return false;

final assignment = ConsoleVariableAssignment.tryParse(expressionText);
if (assignment == null) return false;
const kSuccess = true;
Expand Down
Expand Up @@ -8,7 +8,6 @@ import 'dart:math';
import 'package:vm_service/vm_service.dart';

import '../../../devtools_app.dart';
import '../feature_flags.dart';
import '../memory/adapted_heap_data.dart';
import '../memory/class_name.dart';
import 'dart_object_node.dart';
Expand Down Expand Up @@ -53,7 +52,6 @@ HeapObjectSelection _refreshStaticSelection(
Future<void> addChildReferences(
DartObjectNode variable,
) async {
assert(FeatureFlags.evalAndBrowse);
final ref = variable.ref!;
if (ref is! ObjectReferences) {
throw StateError('Wrong type: ${ref.runtimeType}');
Expand Down
Expand Up @@ -9,7 +9,6 @@ import 'package:logging/logging.dart';
import 'package:vm_service/vm_service.dart';

import '../../screens/debugger/debugger_model.dart';
import '../feature_flags.dart';
import '../globals.dart';
import '../memory/adapted_heap_data.dart';
import '../primitives/utils.dart';
Expand Down Expand Up @@ -409,8 +408,7 @@ Future<void> buildVariablesTree(
variable.addChild(DartObjectNode.text('error: $ex\n$stack'));
}

if (FeatureFlags.evalAndBrowse &&
ref.heapSelection != null &&
if (ref.heapSelection != null &&
ref is! ObjectReferences &&
!variable.isGroup) {
addReferencesRoot(variable, ref);
Expand Down
6 changes: 0 additions & 6 deletions packages/devtools_app/lib/src/shared/feature_flags.dart
Expand Up @@ -53,18 +53,12 @@ abstract class FeatureFlags {
/// https://github.com/flutter/devtools/issues/4564.
static bool widgetRebuildstats = enableExperiments;

/// Flag to enable live eval and snapshot browse.
///
/// https://github.com/flutter/devtools/issues/4962.
static bool evalAndBrowse = enableExperiments;

/// Stores a map of all the feature flags for debugging purposes.
///
/// When adding a new flag, you are responsible for adding it to this map as
/// well.
static final _allFlags = <String, bool>{
'widgetRebuildStats': widgetRebuildstats,
'evalAndBrowseSnapshot': evalAndBrowse,
};

/// A helper to print the status of all the feature flags.
Expand Down
1 change: 1 addition & 0 deletions packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Expand Up @@ -41,6 +41,7 @@ jank is detected on an iOS device. - [#5455](https://github.com/flutter/devtools

## Memory updates
* Fix filtering bug in the "Trace Instances" view - [#5406](https://github.com/flutter/devtools/pull/5406)
* Enabled evaluation and browsing for instances in heap snapshot - [#5542](https://github.com/flutter/devtools/pull/5542)
* Fix heap snapshot failure - [5520](https://github.com/flutter/devtools/pull/5520)

## Debugger updates
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit db0c403

Please sign in to comment.