| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "platform/json.h" | 9 #include "platform/json.h" |
| 10 #include "lib/mirrors.h" | 10 #include "lib/mirrors.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 StartIsolateScope start_scope(isolate_); | 102 StartIsolateScope start_scope(isolate_); |
| 103 StackZone zone(isolate_); | 103 StackZone zone(isolate_); |
| 104 HandleScope handle_scope(isolate_); | 104 HandleScope handle_scope(isolate_); |
| 105 | 105 |
| 106 // If the message is in band we lookup the receive port to dispatch to. If | 106 // If the message is in band we lookup the receive port to dispatch to. If |
| 107 // the receive port is closed, we drop the message without deserializing it. | 107 // the receive port is closed, we drop the message without deserializing it. |
| 108 Object& receive_port = Object::Handle(); | 108 Object& receive_port = Object::Handle(); |
| 109 if (!message->IsOOB()) { | 109 if (!message->IsOOB()) { |
| 110 receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port()); | 110 receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port()); |
| 111 if (receive_port.IsError()) { | 111 if (receive_port.IsError()) { |
| 112 return ProcessUnhandledException(Instance::Handle(), | 112 return ProcessUnhandledException(Object::null_instance(), |
| 113 Error::Cast(receive_port)); | 113 Error::Cast(receive_port)); |
| 114 } | 114 } |
| 115 if (receive_port.IsNull()) { | 115 if (receive_port.IsNull()) { |
| 116 delete message; | 116 delete message; |
| 117 return true; | 117 return true; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Parse the message. | 121 // Parse the message. |
| 122 SnapshotReader reader(message->data(), message->len(), | 122 SnapshotReader reader(message->data(), message->len(), |
| 123 Snapshot::kMessage, Isolate::Current()); | 123 Snapshot::kMessage, Isolate::Current()); |
| 124 const Object& msg_obj = Object::Handle(reader.ReadObject()); | 124 const Object& msg_obj = Object::Handle(reader.ReadObject()); |
| 125 if (msg_obj.IsError()) { | 125 if (msg_obj.IsError()) { |
| 126 // An error occurred while reading the message. | 126 // An error occurred while reading the message. |
| 127 return ProcessUnhandledException(Instance::Handle(), Error::Cast(msg_obj)); | 127 return ProcessUnhandledException(Object::null_instance(), |
| 128 Error::Cast(msg_obj)); |
| 128 } | 129 } |
| 129 if (!msg_obj.IsNull() && !msg_obj.IsInstance()) { | 130 if (!msg_obj.IsNull() && !msg_obj.IsInstance()) { |
| 130 // TODO(turnidge): We need to decide what an isolate does with | 131 // TODO(turnidge): We need to decide what an isolate does with |
| 131 // malformed messages. If they (eventually) come from a remote | 132 // malformed messages. If they (eventually) come from a remote |
| 132 // machine, then it might make sense to drop the message entirely. | 133 // machine, then it might make sense to drop the message entirely. |
| 133 // In the case that the message originated locally, which is | 134 // In the case that the message originated locally, which is |
| 134 // always true for now, then this should never occur. | 135 // always true for now, then this should never occur. |
| 135 UNREACHABLE(); | 136 UNREACHABLE(); |
| 136 } | 137 } |
| 137 | 138 |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 return func.raw(); | 1188 return func.raw(); |
| 1188 } | 1189 } |
| 1189 | 1190 |
| 1190 | 1191 |
| 1191 void IsolateSpawnState::Cleanup() { | 1192 void IsolateSpawnState::Cleanup() { |
| 1192 SwitchIsolateScope switch_scope(isolate()); | 1193 SwitchIsolateScope switch_scope(isolate()); |
| 1193 Dart::ShutdownIsolate(); | 1194 Dart::ShutdownIsolate(); |
| 1194 } | 1195 } |
| 1195 | 1196 |
| 1196 } // namespace dart | 1197 } // namespace dart |
| OLD | NEW |