Chromium Code Reviews| Index: runtime/vm/profiler_service.cc |
| diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc |
| index 7ea7d3b129cc138ebf54bb7b7f3494861c74cffb..02a75d3525f12fc49e0cf8ec6330d6ca443a864a 100644 |
| --- a/runtime/vm/profiler_service.cc |
| +++ b/runtime/vm/profiler_service.cc |
| @@ -1051,13 +1051,7 @@ class ProfileBuilder : public ValueObject { |
| void FilterSamples() { |
| ScopeTimer sw("ProfileBuilder::FilterSamples", FLAG_trace_profiler); |
| - Isolate* isolate = thread_->isolate(); |
| - MutexLocker profiler_data_lock(isolate->profiler_data_mutex()); |
| - IsolateProfilerData* profiler_data = isolate->profiler_data(); |
| - if (profiler_data == NULL) { |
| - return; |
| - } |
| - SampleBuffer* sample_buffer = profiler_data->sample_buffer(); |
| + SampleBuffer* sample_buffer = Profiler::sample_buffer(); |
| if (sample_buffer == NULL) { |
| return; |
| } |
| @@ -2202,16 +2196,13 @@ void ProfilerService::PrintJSONImpl(Thread* thread, |
| intptr_t extra_tags, |
| SampleFilter* filter) { |
| Isolate* isolate = thread->isolate(); |
| - // Disable profile interrupts while processing the buffer. |
| - Profiler::EndExecution(isolate); |
| + // Disable thread interrupts while processing the buffer. |
| + thread->DisableThreadInterrupts(); |
|
Ivan Posva
2015/10/28 19:31:53
Should we have a DisableInterruptsScope?
Cutch
2015/10/28 19:50:33
Done here and below.
|
| - { |
| - MutexLocker profiler_data_lock(isolate->profiler_data_mutex()); |
| - IsolateProfilerData* profiler_data = isolate->profiler_data(); |
| - if (profiler_data == NULL) { |
| - stream->PrintError(kFeatureDisabled, NULL); |
| - return; |
| - } |
| + SampleBuffer* sample_buffer = Profiler::sample_buffer(); |
| + if (sample_buffer == NULL) { |
| + stream->PrintError(kFeatureDisabled, NULL); |
| + return; |
| } |
| { |
| @@ -2222,8 +2213,8 @@ void ProfilerService::PrintJSONImpl(Thread* thread, |
| profile.PrintJSON(stream); |
| } |
| - // Enable profile interrupts. |
| - Profiler::BeginExecution(isolate); |
| + // Re-enable. |
| + thread->EnableThreadInterrupts(); |
| } |
| @@ -2278,24 +2269,22 @@ void ProfilerService::PrintAllocationJSON(JSONStream* stream, |
| void ProfilerService::ClearSamples() { |
| - Isolate* isolate = Isolate::Current(); |
| - |
| - // Disable profile interrupts while processing the buffer. |
| - Profiler::EndExecution(isolate); |
| - |
| - MutexLocker profiler_data_lock(isolate->profiler_data_mutex()); |
| - IsolateProfilerData* profiler_data = isolate->profiler_data(); |
| - if (profiler_data == NULL) { |
| + SampleBuffer* sample_buffer = Profiler::sample_buffer(); |
| + if (sample_buffer == NULL) { |
| return; |
| } |
| - SampleBuffer* sample_buffer = profiler_data->sample_buffer(); |
| - ASSERT(sample_buffer != NULL); |
| + |
| + Thread* thread = Thread::Current(); |
| + Isolate* isolate = thread->isolate(); |
| + |
| + // Disable thread interrupts while processing the buffer. |
| + thread->DisableThreadInterrupts(); |
| ClearProfileVisitor clear_profile(isolate); |
| sample_buffer->VisitSamples(&clear_profile); |
| - // Enable profile interrupts. |
| - Profiler::BeginExecution(isolate); |
| + // Re-enable. |
| + thread->EnableThreadInterrupts(); |
| } |
| } // namespace dart |