Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: runtime/observatory/lib/src/elements/metrics.dart

Issue 1262003002: Fix exception on first navigation to metrics page (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/elements/metrics.dart
diff --git a/runtime/observatory/lib/src/elements/metrics.dart b/runtime/observatory/lib/src/elements/metrics.dart
index b7e4e798406f25bfa0a67498bc6c416c1b21089e..73343c5fe7819dd701a8f2396a1e1fdb9642cac7 100644
--- a/runtime/observatory/lib/src/elements/metrics.dart
+++ b/runtime/observatory/lib/src/elements/metrics.dart
@@ -27,13 +27,22 @@ class MetricsPageElement extends ObservatoryElement {
if ((isolate != null) && (page != null) &&
(page.selectedMetricId != null)) {
selectedMetric = isolate.dartMetrics[page.selectedMetricId];
- if (selectedMetric == null) {
- selectedMetric = isolate.nativeMetrics[page.selectedMetricId];
+ if (selectedMetric != null) {
+ return;
}
+ selectedMetric = isolate.nativeMetrics[page.selectedMetricId];
}
if ((selectedMetric == null) && (isolate != null)) {
- var values = isolate.dartMetrics.values;
- if (values != null) {
+ var values = isolate.dartMetrics.values.toList();
+ if ((values != null) && (values.length > 0)) {
+ // Fall back and pick the first isolate metric.
+ selectedMetric = values.first;
+ }
+ if (selectedMetric != null) {
+ return;
+ }
+ values = isolate.nativeMetrics.values.toList();
+ if ((values != null) && (values.length > 0)) {
// Fall back and pick the first isolate metric.
selectedMetric = values.first;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698