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

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

Issue 1065303003: Fix auto-refresh in Heap profile. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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 | runtime/observatory/lib/src/elements/heap_profile.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/elements/heap_profile.dart
===================================================================
--- runtime/observatory/lib/src/elements/heap_profile.dart (revision 44977)
+++ runtime/observatory/lib/src/elements/heap_profile.dart (working copy)
@@ -6,6 +6,7 @@
import 'dart:html';
import 'observatory_element.dart';
+import 'package:logging/logging.dart';
import 'package:observatory/app.dart';
import 'package:observatory/service.dart';
import 'package:observatory/elements.dart';
@@ -102,13 +103,34 @@
_subscription.cancel((){});
super.detached();
}
-
+
+ // Keep at most one outstanding auto-refresh RPC.
+ bool refreshAutoPending = false;
+ bool refreshAutoQueued = false;
+
void _onEvent(ServiceEvent event) {
if (autoRefresh && event.eventType == 'GC') {
- refresh((){});
+ if (!refreshAutoPending) {
+ refreshAuto();
+ } else {
+ // Remember to refresh once more, to ensure latest profile.
+ refreshAutoQueued = true;
+ }
}
}
+ void refreshAuto() {
+ refreshAutoPending = true;
+ refreshAutoQueued = false;
+ refresh(() {
+ refreshAutoPending = false;
+ // Keep refreshing if at least one GC event was received while waiting.
+ if (refreshAutoQueued) {
+ refreshAuto();
+ }
+ });
+ }
+
void _updatePieCharts() {
assert(profile != null);
_newPieDataTable.clearRows();
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/heap_profile.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698