| 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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 SnapshotReader reader(obj_data, obj_len, Snapshot::kMessage, isolate); | 1398 SnapshotReader reader(obj_data, obj_len, Snapshot::kMessage, isolate); |
| 1399 const Object& obj = Object::Handle(isolate, reader.ReadObject()); | 1399 const Object& obj = Object::Handle(isolate, reader.ReadObject()); |
| 1400 ASSERT(!obj.IsError()); | 1400 ASSERT(!obj.IsError()); |
| 1401 Instance& instance = Instance::Handle(isolate); | 1401 Instance& instance = Instance::Handle(isolate); |
| 1402 instance ^= obj.raw(); // Can't use Instance::Cast because may be null. | 1402 instance ^= obj.raw(); // Can't use Instance::Cast because may be null. |
| 1403 return instance.raw(); | 1403 return instance.raw(); |
| 1404 } | 1404 } |
| 1405 | 1405 |
| 1406 | 1406 |
| 1407 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, | 1407 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, |
| 1408 void* init_data, |
| 1408 const Function& func, | 1409 const Function& func, |
| 1409 const Instance& message) | 1410 const Instance& message) |
| 1410 : isolate_(NULL), | 1411 : isolate_(NULL), |
| 1411 parent_port_(parent_port), | 1412 parent_port_(parent_port), |
| 1413 init_data_(init_data), |
| 1412 script_url_(NULL), | 1414 script_url_(NULL), |
| 1413 library_url_(NULL), | 1415 library_url_(NULL), |
| 1414 class_name_(NULL), | 1416 class_name_(NULL), |
| 1415 function_name_(NULL), | 1417 function_name_(NULL), |
| 1416 exception_callback_name_(NULL), | 1418 exception_callback_name_(NULL), |
| 1417 serialized_args_(NULL), | 1419 serialized_args_(NULL), |
| 1418 serialized_args_len_(0), | 1420 serialized_args_len_(0), |
| 1419 serialized_message_(NULL), | 1421 serialized_message_(NULL), |
| 1420 serialized_message_len_(0) { | 1422 serialized_message_len_(0) { |
| 1421 script_url_ = NULL; | 1423 script_url_ = NULL; |
| 1422 const Class& cls = Class::Handle(func.Owner()); | 1424 const Class& cls = Class::Handle(func.Owner()); |
| 1423 const Library& lib = Library::Handle(cls.library()); | 1425 const Library& lib = Library::Handle(cls.library()); |
| 1424 const String& lib_url = String::Handle(lib.url()); | 1426 const String& lib_url = String::Handle(lib.url()); |
| 1425 library_url_ = strdup(lib_url.ToCString()); | 1427 library_url_ = strdup(lib_url.ToCString()); |
| 1426 | 1428 |
| 1427 const String& func_name = String::Handle(func.name()); | 1429 const String& func_name = String::Handle(func.name()); |
| 1428 function_name_ = strdup(func_name.ToCString()); | 1430 function_name_ = strdup(func_name.ToCString()); |
| 1429 if (!cls.IsTopLevel()) { | 1431 if (!cls.IsTopLevel()) { |
| 1430 const String& class_name = String::Handle(cls.Name()); | 1432 const String& class_name = String::Handle(cls.Name()); |
| 1431 class_name_ = strdup(class_name.ToCString()); | 1433 class_name_ = strdup(class_name.ToCString()); |
| 1432 } | 1434 } |
| 1433 exception_callback_name_ = strdup("_unhandledExceptionCallback"); | 1435 exception_callback_name_ = strdup("_unhandledExceptionCallback"); |
| 1434 SerializeObject(message, &serialized_message_, &serialized_message_len_); | 1436 SerializeObject(message, &serialized_message_, &serialized_message_len_); |
| 1435 } | 1437 } |
| 1436 | 1438 |
| 1437 | 1439 |
| 1438 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, | 1440 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, |
| 1441 void* init_data, |
| 1439 const char* script_url, | 1442 const char* script_url, |
| 1440 const Instance& args, | 1443 const Instance& args, |
| 1441 const Instance& message) | 1444 const Instance& message) |
| 1442 : isolate_(NULL), | 1445 : isolate_(NULL), |
| 1443 parent_port_(parent_port), | 1446 parent_port_(parent_port), |
| 1447 init_data_(init_data), |
| 1444 library_url_(NULL), | 1448 library_url_(NULL), |
| 1445 class_name_(NULL), | 1449 class_name_(NULL), |
| 1446 function_name_(NULL), | 1450 function_name_(NULL), |
| 1447 exception_callback_name_(NULL), | 1451 exception_callback_name_(NULL), |
| 1448 serialized_args_(NULL), | 1452 serialized_args_(NULL), |
| 1449 serialized_args_len_(0), | 1453 serialized_args_len_(0), |
| 1450 serialized_message_(NULL), | 1454 serialized_message_(NULL), |
| 1451 serialized_message_len_(0) { | 1455 serialized_message_len_(0) { |
| 1452 script_url_ = strdup(script_url); | 1456 script_url_ = strdup(script_url); |
| 1453 library_url_ = NULL; | 1457 library_url_ = NULL; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 serialized_message_, serialized_message_len_); | 1536 serialized_message_, serialized_message_len_); |
| 1533 } | 1537 } |
| 1534 | 1538 |
| 1535 | 1539 |
| 1536 void IsolateSpawnState::Cleanup() { | 1540 void IsolateSpawnState::Cleanup() { |
| 1537 SwitchIsolateScope switch_scope(I); | 1541 SwitchIsolateScope switch_scope(I); |
| 1538 Dart::ShutdownIsolate(); | 1542 Dart::ShutdownIsolate(); |
| 1539 } | 1543 } |
| 1540 | 1544 |
| 1541 } // namespace dart | 1545 } // namespace dart |
| OLD | NEW |