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 = reinterpret_cast<Isolate*>( | 175 Isolate* child_isolate = Api::CastIsolate((callback)(state->script_url(), |
176 (callback)(state->script_url(), | 176 state->function_name(), |
177 state->function_name(), | 177 state->package_root(), |
178 state->package_root(), | 178 init_data, |
179 init_data, | 179 error)); |
180 error)); | |
181 if (child_isolate == NULL) { | 180 if (child_isolate == NULL) { |
182 return false; | 181 return false; |
183 } | 182 } |
184 if (!state->is_spawn_uri()) { | 183 if (!state->is_spawn_uri()) { |
185 // For isolates spawned using the spawnFunction semantics we set | 184 // For isolates spawned using the spawnFunction semantics we set |
186 // the origin_id to the origin_id of the parent isolate. | 185 // the origin_id to the origin_id of the parent isolate. |
187 child_isolate->set_origin_id(parent_isolate->origin_id()); | 186 child_isolate->set_origin_id(parent_isolate->origin_id()); |
188 } | 187 } |
189 state->set_isolate(reinterpret_cast<Isolate*>(child_isolate)); | 188 state->set_isolate(reinterpret_cast<Isolate*>(child_isolate)); |
190 return true; | 189 return true; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 MessageWriter writer(&data, &allocator, false); | 301 MessageWriter writer(&data, &allocator, false); |
303 writer.WriteMessage(msg); | 302 writer.WriteMessage(msg); |
304 | 303 |
305 PortMap::PostMessage(new Message(port.Id(), | 304 PortMap::PostMessage(new Message(port.Id(), |
306 data, writer.BytesWritten(), | 305 data, writer.BytesWritten(), |
307 Message::kOOBPriority)); | 306 Message::kOOBPriority)); |
308 return Object::null(); | 307 return Object::null(); |
309 } | 308 } |
310 | 309 |
311 } // namespace dart | 310 } // namespace dart |
OLD | NEW |