| 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 "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 SnapshotReader reader(obj_data, obj_len, Snapshot::kMessage, isolate); | 1408 SnapshotReader reader(obj_data, obj_len, Snapshot::kMessage, isolate); |
| 1409 const Object& obj = Object::Handle(isolate, reader.ReadObject()); | 1409 const Object& obj = Object::Handle(isolate, reader.ReadObject()); |
| 1410 ASSERT(!obj.IsError()); | 1410 ASSERT(!obj.IsError()); |
| 1411 Instance& instance = Instance::Handle(isolate); | 1411 Instance& instance = Instance::Handle(isolate); |
| 1412 instance ^= obj.raw(); // Can't use Instance::Cast because may be null. | 1412 instance ^= obj.raw(); // Can't use Instance::Cast because may be null. |
| 1413 return instance.raw(); | 1413 return instance.raw(); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 | 1416 |
| 1417 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, | 1417 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, |
| 1418 void* init_data, | |
| 1419 const Function& func, | 1418 const Function& func, |
| 1420 const Instance& message) | 1419 const Instance& message) |
| 1421 : isolate_(NULL), | 1420 : isolate_(NULL), |
| 1422 parent_port_(parent_port), | 1421 parent_port_(parent_port), |
| 1423 init_data_(init_data), | |
| 1424 script_url_(NULL), | 1422 script_url_(NULL), |
| 1425 library_url_(NULL), | 1423 library_url_(NULL), |
| 1426 class_name_(NULL), | 1424 class_name_(NULL), |
| 1427 function_name_(NULL), | 1425 function_name_(NULL), |
| 1428 exception_callback_name_(NULL), | 1426 exception_callback_name_(NULL), |
| 1429 serialized_args_(NULL), | 1427 serialized_args_(NULL), |
| 1430 serialized_args_len_(0), | 1428 serialized_args_len_(0), |
| 1431 serialized_message_(NULL), | 1429 serialized_message_(NULL), |
| 1432 serialized_message_len_(0) { | 1430 serialized_message_len_(0) { |
| 1433 script_url_ = NULL; | 1431 script_url_ = NULL; |
| 1434 const Class& cls = Class::Handle(func.Owner()); | 1432 const Class& cls = Class::Handle(func.Owner()); |
| 1435 const Library& lib = Library::Handle(cls.library()); | 1433 const Library& lib = Library::Handle(cls.library()); |
| 1436 const String& lib_url = String::Handle(lib.url()); | 1434 const String& lib_url = String::Handle(lib.url()); |
| 1437 library_url_ = strdup(lib_url.ToCString()); | 1435 library_url_ = strdup(lib_url.ToCString()); |
| 1438 | 1436 |
| 1439 const String& func_name = String::Handle(func.name()); | 1437 const String& func_name = String::Handle(func.name()); |
| 1440 function_name_ = strdup(func_name.ToCString()); | 1438 function_name_ = strdup(func_name.ToCString()); |
| 1441 if (!cls.IsTopLevel()) { | 1439 if (!cls.IsTopLevel()) { |
| 1442 const String& class_name = String::Handle(cls.Name()); | 1440 const String& class_name = String::Handle(cls.Name()); |
| 1443 class_name_ = strdup(class_name.ToCString()); | 1441 class_name_ = strdup(class_name.ToCString()); |
| 1444 } | 1442 } |
| 1445 exception_callback_name_ = strdup("_unhandledExceptionCallback"); | 1443 exception_callback_name_ = strdup("_unhandledExceptionCallback"); |
| 1446 SerializeObject(message, &serialized_message_, &serialized_message_len_); | 1444 SerializeObject(message, &serialized_message_, &serialized_message_len_); |
| 1447 } | 1445 } |
| 1448 | 1446 |
| 1449 | 1447 |
| 1450 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, | 1448 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, |
| 1451 void* init_data, | |
| 1452 const char* script_url, | 1449 const char* script_url, |
| 1453 const Instance& args, | 1450 const Instance& args, |
| 1454 const Instance& message) | 1451 const Instance& message) |
| 1455 : isolate_(NULL), | 1452 : isolate_(NULL), |
| 1456 parent_port_(parent_port), | 1453 parent_port_(parent_port), |
| 1457 init_data_(init_data), | |
| 1458 library_url_(NULL), | 1454 library_url_(NULL), |
| 1459 class_name_(NULL), | 1455 class_name_(NULL), |
| 1460 function_name_(NULL), | 1456 function_name_(NULL), |
| 1461 exception_callback_name_(NULL), | 1457 exception_callback_name_(NULL), |
| 1462 serialized_args_(NULL), | 1458 serialized_args_(NULL), |
| 1463 serialized_args_len_(0), | 1459 serialized_args_len_(0), |
| 1464 serialized_message_(NULL), | 1460 serialized_message_(NULL), |
| 1465 serialized_message_len_(0) { | 1461 serialized_message_len_(0) { |
| 1466 script_url_ = strdup(script_url); | 1462 script_url_ = strdup(script_url); |
| 1467 library_url_ = NULL; | 1463 library_url_ = NULL; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 serialized_message_, serialized_message_len_); | 1542 serialized_message_, serialized_message_len_); |
| 1547 } | 1543 } |
| 1548 | 1544 |
| 1549 | 1545 |
| 1550 void IsolateSpawnState::Cleanup() { | 1546 void IsolateSpawnState::Cleanup() { |
| 1551 SwitchIsolateScope switch_scope(I); | 1547 SwitchIsolateScope switch_scope(I); |
| 1552 Dart::ShutdownIsolate(); | 1548 Dart::ShutdownIsolate(); |
| 1553 } | 1549 } |
| 1554 | 1550 |
| 1555 } // namespace dart | 1551 } // namespace dart |
| OLD | NEW |