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

Unified Diff: runtime/vm/debugger_api_impl.cc

Issue 14246043: Create handle scope in debugger callback (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_api_impl.cc
===================================================================
--- runtime/vm/debugger_api_impl.cc (revision 21746)
+++ runtime/vm/debugger_api_impl.cc (working copy)
@@ -111,47 +111,43 @@
Isolate* isolate = Isolate::Current();
ASSERT(isolate != NULL);
ASSERT(isolate->debugger() != NULL);
+ Dart_EnterScope();
Dart_IsolateId isolate_id = isolate->debugger()->GetIsolateId();
if (event->type == Debugger::kBreakpointReached) {
if (legacy_bp_handler != NULL) {
Dart_StackTrace stack_trace =
reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace());
(*legacy_bp_handler)(isolate_id, NULL, stack_trace);
- return;
+ } else if (paused_event_handler != NULL) {
+ Dart_CodeLocation location;
+ ActivationFrame* top_frame = event->top_frame;
+ location.script_url = Api::NewHandle(isolate, top_frame->SourceUrl());
+ const Library& lib = Library::Handle(top_frame->Library());
+ location.library_id = lib.index();
+ location.token_pos = top_frame->TokenPos();
+ (*paused_event_handler)(isolate_id, location);
}
- if (paused_event_handler == NULL) {
- return;
- }
- Dart_CodeLocation location;
- ActivationFrame* top_frame = event->top_frame;
- location.script_url = Api::NewHandle(isolate, top_frame->SourceUrl());
- const Library& lib = Library::Handle(top_frame->Library());
- location.library_id = lib.index();
- location.token_pos = top_frame->TokenPos();
- (*paused_event_handler)(isolate_id, location);
} else if (event->type == Debugger::kBreakpointResolved) {
- if (bp_resolved_handler == NULL) {
- return;
+ if (bp_resolved_handler != NULL) {
+ SourceBreakpoint* bpt = event->breakpoint;
+ ASSERT(bpt != NULL);
+ Dart_CodeLocation location;
+ Library& library = Library::Handle(isolate);
+ Script& script = Script::Handle(isolate);
+ intptr_t token_pos;
+ bpt->GetCodeLocation(&library, &script, &token_pos);
+ location.script_url = Api::NewHandle(isolate, script.url());
+ location.library_id = library.index();
+ location.token_pos = token_pos;
+ (*bp_resolved_handler)(isolate_id, bpt->id(), location);
}
- SourceBreakpoint* bpt = event->breakpoint;
- ASSERT(bpt != NULL);
- Dart_CodeLocation location;
- Library& library = Library::Handle(isolate);
- Script& script = Script::Handle(isolate);
- intptr_t token_pos;
- bpt->GetCodeLocation(&library, &script, &token_pos);
- location.script_url = Api::NewHandle(isolate, script.url());
- location.library_id = library.index();
- location.token_pos = token_pos;
- (*bp_resolved_handler)(isolate_id, bpt->id(), location);
} else if (event->type == Debugger::kExceptionThrown) {
- if (exc_thrown_handler == NULL) {
- return;
+ if (exc_thrown_handler != NULL) {
+ Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw());
+ Dart_StackTrace trace =
+ reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace());
+ (*exc_thrown_handler)(isolate_id, exception, trace);
}
- Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw());
- Dart_StackTrace trace =
- reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace());
- (*exc_thrown_handler)(isolate_id, exception, trace);
} else if (event->type == Debugger::kIsolateCreated) {
if (isolate_event_handler != NULL) {
(*isolate_event_handler)(event->isolate_id, kCreated);
@@ -167,6 +163,7 @@
} else {
UNIMPLEMENTED();
}
+ Dart_ExitScope();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698