Skip to content

Commit

Permalink
Use Chain.capture instead of runZoned
Browse files Browse the repository at this point in the history
- [x] Swap all calls of runZoned to Chain.capture.

Chain.capture is a wrapper around runZoned that tracks stack traces across asynchronous gaps.

[email protected]

Review URL: https://codereview.chromium.org/2349753002 .
  • Loading branch information
johnmccutchan committed Sep 16, 2016
1 parent 3360b3c commit 0d831bd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions runtime/observatory/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:observatory/models.dart' as M;
import 'package:observatory/repositories.dart';
import 'package:observatory/tracer.dart';
import 'package:observatory/utils.dart';
import 'package:stack_trace/stack_trace.dart';
import 'package:usage/usage_html.dart';

export 'package:observatory/utils.dart';
Expand Down
2 changes: 1 addition & 1 deletion runtime/observatory/lib/src/app/location_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class LocationManager {

/// Notify the current page that something has changed.
_visit() {
runZoned(() => _app._visit(_uri, internalArguments), onError: (e, st) {
Chain.capture(() => _app._visit(_uri, internalArguments), onError: (e, st) {
if (e is IsolateNotFound) {
var newPath = ((_app.vm == null || _app.vm.isDisconnected)
? '/vm-connect'
Expand Down
1 change: 0 additions & 1 deletion runtime/observatory/lib/src/elements/instance_ref.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:observatory/src/elements/helpers/any_ref.dart';
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
import 'package:observatory/src/elements/helpers/tag.dart';
import 'package:observatory/src/elements/helpers/uris.dart';
import 'package:observatory/src/elements/sentinel_value.dart';
import 'package:observatory/utils.dart';

class InstanceRefElement extends HtmlElement implements Renderable {
Expand Down
5 changes: 3 additions & 2 deletions runtime/observatory/tests/service/test_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:observatory/service_io.dart';
import 'package:stack_trace/stack_trace.dart';
import 'service_test_common.dart';

/// Will be set to the http address of the VM's service protocol before
Expand Down Expand Up @@ -271,7 +272,7 @@ class _FlutterDeviceServiceTesterRunner {
serviceWebsocketAddress = 'ws://localhost:$port/ws';
serviceHttpAddress = 'http://localhost:$port';
var name = Platform.script.pathSegments.last;
runZoned(() async {
Chain.capture(() async {
var vm =
new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress));
print('Loading VM...');
Expand Down Expand Up @@ -338,7 +339,7 @@ class _ServiceTesterRunner {
serviceWebsocketAddress = 'ws://localhost:$port/ws';
serviceHttpAddress = 'http://localhost:$port';
var name = Platform.script.pathSegments.last;
runZoned(() async {
Chain.capture(() async {
var vm =
new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress));
print('Loading VM...');
Expand Down

0 comments on commit 0d831bd

Please sign in to comment.