Skip to content

Commit

Permalink
Remove extraneous calls to allowInterop (#966)
Browse files Browse the repository at this point in the history
`allowInterop` is intended for use with `package:js` style callback
arguments to `@JS()` annotated APIs, it is unnecessary when using APIs
from `dart:html`.

This had been put in to work around dart-lang/sdk#35484
which has since been solved.
  • Loading branch information
natebosch committed Aug 27, 2019
1 parent 0a0eab7 commit 846e351
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
11 changes: 4 additions & 7 deletions packages/devtools/lib/src/timeline/event_details.dart
Expand Up @@ -3,8 +3,6 @@
// found in the LICENSE file.
import 'dart:html' as html;

import 'package:js/js.dart';

import '../globals.dart';
import '../profiler/cpu_profile_flame_chart.dart';
import '../profiler/cpu_profile_tables.dart';
Expand All @@ -28,12 +26,11 @@ class EventDetails extends CoreElement {
// The size of the event details section will change as the splitter is
// is moved. Observe resizing so that we can rebuild the flame chart canvas
// as necessary.
// TODO(kenzie): clean this code up when
// https://github.com/dart-lang/html/issues/104 is fixed.
final observer =
html.ResizeObserver(allowInterop((List<dynamic> entries, _) {
// TODO(jacobr): Change argument type when
// https://github.com/dart-lang/sdk/issues/36798 is fixed.
final observer = html.ResizeObserver((List<dynamic> entries, _) {
cpuProfiler.flameChart.updateForContainerResize();
}));
});
observer.observe(element);

assert(tabNav != null);
Expand Down
10 changes: 4 additions & 6 deletions packages/devtools/lib/src/timeline/timeline_screen.dart
Expand Up @@ -6,7 +6,6 @@ import 'dart:convert';
import 'dart:html' as html;
import 'dart:math' as math;

import 'package:js/js.dart';
import 'package:meta/meta.dart';
import 'package:split/split.dart' as split;

Expand Down Expand Up @@ -274,10 +273,9 @@ class TimelineScreen extends Screen {
// The size of [flameChartContainer] will change as the splitter moved.
// Observe resizing so that we can rebuild the flame chart canvas as
// necessary.
// TODO(kenzie): clean this code up when
// https://github.com/dart-lang/html/issues/104 is fixed.
final observer =
html.ResizeObserver(allowInterop((List<dynamic> entries, _) {
// TODO(jacobr): Change argument type when
// https://github.com/dart-lang/sdk/issues/36798 is fixed.
final observer = html.ResizeObserver((List<dynamic> entries, _) {
// TODO(kenzie): observe resizing for recordedTimeline as well. Recorded
// timeline will not have a selected frame.
if (flameChartCanvas == null ||
Expand All @@ -300,7 +298,7 @@ class TimelineScreen extends Screen {
TimelineFlameChartCanvas.sectionSpacing,
),
);
}));
});
observer.observe(flameChartContainer.element);
}

Expand Down
9 changes: 4 additions & 5 deletions packages/devtools/lib/src/ui/viewport_canvas.dart
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

import 'dart:html' hide VoidCallback;
import 'dart:js';

import 'package:meta/meta.dart';

Expand Down Expand Up @@ -169,11 +168,11 @@ class ViewportCanvas extends Object with SetStateMixin {
..overflow = 'hidden';
_element.add(_content);

// TODO(jacobr): clean this code up when
// https://github.com/dart-lang/html/issues/104 is fixed.
_resizeObserver = ResizeObserver(allowInterop((List<dynamic> entries, _) {
// TODO(jacobr): Change argument type when
// https://github.com/dart-lang/sdk/issues/36798 is fixed.
_resizeObserver = ResizeObserver((List<dynamic> entries, _) {
_scheduleRebuild();
}));
});
_resizeObserver.observe(_element.element);

element.onScroll.listen((_) {
Expand Down

0 comments on commit 846e351

Please sign in to comment.