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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 ASSERT(spawned_isolate != NULL); | 291 ASSERT(spawned_isolate != NULL); |
292 // Check arguments to see if the specified library and classes are | 292 // Check arguments to see if the specified library and classes are |
293 // loaded, this check will throw an exception if they are not loaded. | 293 // loaded, this check will throw an exception if they are not loaded. |
294 if (init_successful && CheckArguments(library_url, class_name)) { | 294 if (init_successful && CheckArguments(library_url, class_name)) { |
295 port_id = spawned_isolate->main_port(); | 295 port_id = spawned_isolate->main_port(); |
296 uword data = reinterpret_cast<uword>( | 296 uword data = reinterpret_cast<uword>( |
297 new IsolateStartData(spawned_isolate, | 297 new IsolateStartData(spawned_isolate, |
298 strdup(library_url), | 298 strdup(library_url), |
299 strdup(class_name), | 299 strdup(class_name), |
300 port_id)); | 300 port_id)); |
301 new Thread(RunIsolate, data); | 301 int result = Thread::Start(RunIsolate, data); |
| 302 if (result != 0) { |
| 303 FATAL1("Failed to start isolate thread %d", result); |
| 304 } |
302 } else { | 305 } else { |
303 // Error spawning the isolate, maybe due to initialization errors or | 306 // Error spawning the isolate, maybe due to initialization errors or |
304 // errors while loading the application into spawned isolate, shut | 307 // errors while loading the application into spawned isolate, shut |
305 // it down and report error. | 308 // it down and report error. |
306 // Make sure to grab the error message out of the isolate before it has | 309 // Make sure to grab the error message out of the isolate before it has |
307 // been shutdown and to allocate it in the preserved isolates zone. | 310 // been shutdown and to allocate it in the preserved isolates zone. |
308 { | 311 { |
309 Zone zone(spawned_isolate); | 312 Zone zone(spawned_isolate); |
310 HandleScope scope(spawned_isolate); | 313 HandleScope scope(spawned_isolate); |
311 const Error& err_obj = Error::Handle( | 314 const Error& err_obj = Error::Handle( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); | 362 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); |
360 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); | 363 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); |
361 // TODO(iposva): Allow for arbitrary messages to be sent. | 364 // TODO(iposva): Allow for arbitrary messages to be sent. |
362 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); | 365 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); |
363 | 366 |
364 // TODO(turnidge): Throw an exception when the return value is false? | 367 // TODO(turnidge): Throw an exception when the return value is false? |
365 PortMap::PostMessage(send_id, reply_id, Api::CastMessage(data)); | 368 PortMap::PostMessage(send_id, reply_id, Api::CastMessage(data)); |
366 } | 369 } |
367 | 370 |
368 } // namespace dart | 371 } // namespace dart |
OLD | NEW |