Index: runtime/vm/profiler.cc |
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc |
index de2afea156800d813254301cd5df6486242ec88a..419c0ff05a6f936b8de5d2ba519785c7423be2d7 100644 |
--- a/runtime/vm/profiler.cc |
+++ b/runtime/vm/profiler.cc |
@@ -1585,6 +1585,7 @@ IsolateProfilerData::IsolateProfilerData(SampleBuffer* sample_buffer, |
ASSERT(sample_buffer != NULL); |
sample_buffer_ = sample_buffer; |
own_sample_buffer_ = own_sample_buffer; |
+ block_count_ = 0; |
} |
@@ -1597,6 +1598,23 @@ IsolateProfilerData::~IsolateProfilerData() { |
} |
+void IsolateProfilerData::Block() { |
+ block_count_++; |
+} |
+ |
+ |
+void IsolateProfilerData::Unblock() { |
+ block_count_--; |
+ if (block_count_ < 0) { |
+ FATAL("Too many calls to Dart_IsolateUnblocked."); |
+ } |
+ if (!blocked()) { |
+ // We just unblocked this isolate, wake up the thread interrupter. |
+ ThreadInterrupter::WakeUp(); |
+ } |
+} |
+ |
+ |
Sample* SampleBuffer::ReserveSample() { |
ASSERT(samples_ != NULL); |
uintptr_t cursor = AtomicOperations::FetchAndIncrement(&cursor_); |