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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 static bool CreateIsolate(Isolate* parent_isolate, | 165 static bool CreateIsolate(Isolate* parent_isolate, |
166 IsolateSpawnState* state, | 166 IsolateSpawnState* state, |
167 char** error) { | 167 char** error) { |
168 Dart_IsolateCreateCallback callback = Isolate::CreateCallback(); | 168 Dart_IsolateCreateCallback callback = Isolate::CreateCallback(); |
169 if (callback == NULL) { | 169 if (callback == NULL) { |
170 *error = strdup("Null callback specified for isolate creation\n"); | 170 *error = strdup("Null callback specified for isolate creation\n"); |
171 return false; | 171 return false; |
172 } | 172 } |
173 | 173 |
174 void* init_data = parent_isolate->init_callback_data(); | 174 void* init_data = parent_isolate->init_callback_data(); |
175 Isolate* child_isolate = Api::CastIsolate((callback)(state->script_url(), | 175 Isolate* child_isolate = reinterpret_cast<Isolate*>( |
176 state->function_name(), | 176 (callback)(state->script_url(), |
177 state->package_root(), | 177 state->function_name(), |
178 init_data, | 178 state->package_root(), |
179 error)); | 179 init_data, |
| 180 error)); |
180 if (child_isolate == NULL) { | 181 if (child_isolate == NULL) { |
181 return false; | 182 return false; |
182 } | 183 } |
183 if (!state->is_spawn_uri()) { | 184 if (!state->is_spawn_uri()) { |
184 // For isolates spawned using the spawnFunction semantics we set | 185 // For isolates spawned using the spawnFunction semantics we set |
185 // the origin_id to the origin_id of the parent isolate. | 186 // the origin_id to the origin_id of the parent isolate. |
186 child_isolate->set_origin_id(parent_isolate->origin_id()); | 187 child_isolate->set_origin_id(parent_isolate->origin_id()); |
187 } | 188 } |
188 state->set_isolate(reinterpret_cast<Isolate*>(child_isolate)); | 189 state->set_isolate(reinterpret_cast<Isolate*>(child_isolate)); |
189 return true; | 190 return true; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 MessageWriter writer(&data, &allocator, false); | 302 MessageWriter writer(&data, &allocator, false); |
302 writer.WriteMessage(msg); | 303 writer.WriteMessage(msg); |
303 | 304 |
304 PortMap::PostMessage(new Message(port.Id(), | 305 PortMap::PostMessage(new Message(port.Id(), |
305 data, writer.BytesWritten(), | 306 data, writer.BytesWritten(), |
306 Message::kOOBPriority)); | 307 Message::kOOBPriority)); |
307 return Object::null(); | 308 return Object::null(); |
308 } | 309 } |
309 | 310 |
310 } // namespace dart | 311 } // namespace dart |
OLD | NEW |