OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/isolate.h" | 5 #include "vm/isolate.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "lib/mirrors.h" | 9 #include "lib/mirrors.h" |
10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 if (message->IsOOB()) { | 104 if (message->IsOOB()) { |
105 // For now the only OOB messages are Mirrors messages. | 105 // For now the only OOB messages are Mirrors messages. |
106 HandleMirrorsMessage(isolate_, message->reply_port(), msg); | 106 HandleMirrorsMessage(isolate_, message->reply_port(), msg); |
107 delete message; | 107 delete message; |
108 } else { | 108 } else { |
109 const Object& result = Object::Handle( | 109 const Object& result = Object::Handle( |
110 DartLibraryCalls::HandleMessage( | 110 DartLibraryCalls::HandleMessage( |
111 message->dest_port(), message->reply_port(), msg)); | 111 message->dest_port(), message->reply_port(), msg)); |
112 delete message; | 112 delete message; |
113 if (result.IsError()) { | 113 if (result.IsError() || result.IsUnhandledException()) { |
114 isolate_->object_store()->set_sticky_error(Error::Cast(result)); | 114 if (result.IsError()) { |
| 115 isolate_->object_store()->set_sticky_error(Error::Cast(result)); |
| 116 } |
| 117 if (Isolate::UnhandledExceptionCallback() != NULL) { |
| 118 Dart_EnterScope(); |
| 119 Dart_Handle error = Api::NewHandle(isolate_, result.raw()); |
| 120 (Isolate::UnhandledExceptionCallback())(error); |
| 121 } |
115 return false; | 122 return false; |
116 } | 123 } |
117 ASSERT(result.IsNull()); | 124 ASSERT(result.IsNull()); |
118 } | 125 } |
119 return true; | 126 return true; |
120 } | 127 } |
121 | 128 |
122 | 129 |
123 #if defined(DEBUG) | 130 #if defined(DEBUG) |
124 void IsolateMessageHandler::CheckAccess() { | 131 void IsolateMessageHandler::CheckAccess() { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 "\tisolate: %s\n", name()); | 446 "\tisolate: %s\n", name()); |
440 } | 447 } |
441 // TODO(5411455): For now just make sure there are no current isolates | 448 // TODO(5411455): For now just make sure there are no current isolates |
442 // as we are shutting down the isolate. | 449 // as we are shutting down the isolate. |
443 SetCurrent(NULL); | 450 SetCurrent(NULL); |
444 } | 451 } |
445 | 452 |
446 | 453 |
447 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 454 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
448 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; | 455 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; |
| 456 Dart_IsolateUnhandledExceptionCallback |
| 457 Isolate::unhandled_exception_callback_ = NULL; |
449 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 458 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
450 | 459 |
451 | 460 |
452 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, | 461 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, |
453 bool visit_prologue_weak_handles, | 462 bool visit_prologue_weak_handles, |
454 bool validate_frames) { | 463 bool validate_frames) { |
455 ASSERT(visitor != NULL); | 464 ASSERT(visitor != NULL); |
456 | 465 |
457 // Visit objects in the object store. | 466 // Visit objects in the object store. |
458 object_store()->VisitObjectPointers(visitor); | 467 object_store()->VisitObjectPointers(visitor); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 500 |
492 | 501 |
493 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 502 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
494 bool visit_prologue_weak_handles) { | 503 bool visit_prologue_weak_handles) { |
495 if (api_state() != NULL) { | 504 if (api_state() != NULL) { |
496 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 505 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
497 } | 506 } |
498 } | 507 } |
499 | 508 |
500 } // namespace dart | 509 } // namespace dart |
OLD | NEW |