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

Side by Side Diff: runtime/vm/profiler_service.cc

Issue 1120133002: Rework error handling in the service protocol and in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/profiler_service.h" 5 #include "vm/profiler_service.h"
6 6
7 #include "vm/growable_array.h" 7 #include "vm/growable_array.h"
8 #include "vm/native_symbol.h" 8 #include "vm/native_symbol.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 }; 2159 };
2160 2160
2161 2161
2162 void ProfilerService::PrintJSON(JSONStream* stream, TagOrder tag_order) { 2162 void ProfilerService::PrintJSON(JSONStream* stream, TagOrder tag_order) {
2163 Isolate* isolate = Isolate::Current(); 2163 Isolate* isolate = Isolate::Current();
2164 // Disable profile interrupts while processing the buffer. 2164 // Disable profile interrupts while processing the buffer.
2165 Profiler::EndExecution(isolate); 2165 Profiler::EndExecution(isolate);
2166 MutexLocker profiler_data_lock(isolate->profiler_data_mutex()); 2166 MutexLocker profiler_data_lock(isolate->profiler_data_mutex());
2167 IsolateProfilerData* profiler_data = isolate->profiler_data(); 2167 IsolateProfilerData* profiler_data = isolate->profiler_data();
2168 if (profiler_data == NULL) { 2168 if (profiler_data == NULL) {
2169 JSONObject error(stream); 2169 stream->PrintError(kProfilingDisabled, NULL);
2170 error.AddProperty("type", "Error");
2171 error.AddProperty("text", "Isolate does not have profiling enabled.");
2172 return; 2170 return;
2173 } 2171 }
2174 SampleBuffer* sample_buffer = profiler_data->sample_buffer(); 2172 SampleBuffer* sample_buffer = profiler_data->sample_buffer();
2175 ASSERT(sample_buffer != NULL); 2173 ASSERT(sample_buffer != NULL);
2176 ScopeTimer sw("ProfilerService::PrintJSON", FLAG_trace_profiler); 2174 ScopeTimer sw("ProfilerService::PrintJSON", FLAG_trace_profiler);
2177 { 2175 {
2178 StackZone zone(isolate); 2176 StackZone zone(isolate);
2179 HANDLESCOPE(isolate); 2177 HANDLESCOPE(isolate);
2180 { 2178 {
2181 // Live code holds Dart, Native, and Collected CodeRegions. 2179 // Live code holds Dart, Native, and Collected CodeRegions.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 ASSERT(sample_buffer != NULL); 2362 ASSERT(sample_buffer != NULL);
2365 2363
2366 ClearProfileVisitor clear_profile(isolate); 2364 ClearProfileVisitor clear_profile(isolate);
2367 sample_buffer->VisitSamples(&clear_profile); 2365 sample_buffer->VisitSamples(&clear_profile);
2368 2366
2369 // Enable profile interrupts. 2367 // Enable profile interrupts.
2370 Profiler::BeginExecution(isolate); 2368 Profiler::BeginExecution(isolate);
2371 } 2369 }
2372 2370
2373 } // namespace dart 2371 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698