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

Unified Diff: runtime/vm/thread_registry.cc

Issue 1294023009: Switch to a VM wide timeline recorder (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
Index: runtime/vm/thread_registry.cc
diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc
index 8ade009c6035e6762ee9f45b39b1ce2dcc00100c..885219a80802bdd0e9011cc00e25039719c91214 100644
--- a/runtime/vm/thread_registry.cc
+++ b/runtime/vm/thread_registry.cc
@@ -9,6 +9,29 @@
namespace dart {
+ThreadRegistry::~ThreadRegistry() {
+ {
+ // Each thread that is scheduled in this isolate may have a cached timeline
+ // block. Mark these timeline blocks as finished.
+ MonitorLocker ml(monitor_);
+ TimelineEventRecorder* recorder = Timeline::recorder();
+ if (recorder != NULL) {
+ MutexLocker recorder_lock(&recorder->lock_);
+ for (intptr_t i = 0; i < entries_.length(); i++) {
+ // NOTE: It is only safe to access |entry.state| here.
+ const Entry& entry = entries_.At(i);
+ if (entry.state.timeline_block != NULL) {
+ entry.state.timeline_block->Finish();
+ }
+ }
+ }
+ }
+
+ // Delete monitor.
+ delete monitor_;
+}
+
+
void ThreadRegistry::SafepointThreads() {
MonitorLocker ml(monitor_);
// First wait for any older rounds that are still in progress.
« runtime/vm/dart.cc ('K') | « runtime/vm/thread_registry.h ('k') | runtime/vm/timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698