| 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 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 ASSERT(!obj.IsError()); | 1792 ASSERT(!obj.IsError()); |
| 1793 Instance& instance = Instance::Handle(isolate); | 1793 Instance& instance = Instance::Handle(isolate); |
| 1794 instance ^= obj.raw(); // Can't use Instance::Cast because may be null. | 1794 instance ^= obj.raw(); // Can't use Instance::Cast because may be null. |
| 1795 return instance.raw(); | 1795 return instance.raw(); |
| 1796 } | 1796 } |
| 1797 | 1797 |
| 1798 | 1798 |
| 1799 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, | 1799 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, |
| 1800 const Function& func, | 1800 const Function& func, |
| 1801 const Instance& message, | 1801 const Instance& message, |
| 1802 bool paused) | 1802 bool paused, |
| 1803 bool checkedFlag) |
| 1803 : isolate_(NULL), | 1804 : isolate_(NULL), |
| 1804 parent_port_(parent_port), | 1805 parent_port_(parent_port), |
| 1805 script_url_(NULL), | 1806 script_url_(NULL), |
| 1806 package_root_(NULL), | 1807 package_root_(NULL), |
| 1807 library_url_(NULL), | 1808 library_url_(NULL), |
| 1808 class_name_(NULL), | 1809 class_name_(NULL), |
| 1809 function_name_(NULL), | 1810 function_name_(NULL), |
| 1810 serialized_args_(NULL), | 1811 serialized_args_(NULL), |
| 1811 serialized_args_len_(0), | 1812 serialized_args_len_(0), |
| 1812 serialized_message_(NULL), | 1813 serialized_message_(NULL), |
| 1813 serialized_message_len_(0), | 1814 serialized_message_len_(0), |
| 1814 paused_(paused) { | 1815 paused_(paused), |
| 1816 checked_(checkedFlag) { |
| 1815 script_url_ = NULL; | 1817 script_url_ = NULL; |
| 1816 const Class& cls = Class::Handle(func.Owner()); | 1818 const Class& cls = Class::Handle(func.Owner()); |
| 1817 const Library& lib = Library::Handle(cls.library()); | 1819 const Library& lib = Library::Handle(cls.library()); |
| 1818 const String& lib_url = String::Handle(lib.url()); | 1820 const String& lib_url = String::Handle(lib.url()); |
| 1819 library_url_ = strdup(lib_url.ToCString()); | 1821 library_url_ = strdup(lib_url.ToCString()); |
| 1820 | 1822 |
| 1821 const String& func_name = String::Handle(func.name()); | 1823 const String& func_name = String::Handle(func.name()); |
| 1822 function_name_ = strdup(func_name.ToCString()); | 1824 function_name_ = strdup(func_name.ToCString()); |
| 1823 if (!cls.IsTopLevel()) { | 1825 if (!cls.IsTopLevel()) { |
| 1824 const String& class_name = String::Handle(cls.Name()); | 1826 const String& class_name = String::Handle(cls.Name()); |
| 1825 class_name_ = strdup(class_name.ToCString()); | 1827 class_name_ = strdup(class_name.ToCString()); |
| 1826 } | 1828 } |
| 1827 bool can_send_any_object = true; | 1829 bool can_send_any_object = true; |
| 1828 SerializeObject(message, | 1830 SerializeObject(message, |
| 1829 &serialized_message_, | 1831 &serialized_message_, |
| 1830 &serialized_message_len_, | 1832 &serialized_message_len_, |
| 1831 can_send_any_object); | 1833 can_send_any_object); |
| 1832 } | 1834 } |
| 1833 | 1835 |
| 1834 | 1836 |
| 1835 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, | 1837 IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, |
| 1836 const char* script_url, | 1838 const char* script_url, |
| 1837 const char* package_root, | 1839 const char* package_root, |
| 1838 const Instance& args, | 1840 const Instance& args, |
| 1839 const Instance& message, | 1841 const Instance& message, |
| 1840 bool paused) | 1842 bool paused, |
| 1843 bool checkedFlag) |
| 1841 : isolate_(NULL), | 1844 : isolate_(NULL), |
| 1842 parent_port_(parent_port), | 1845 parent_port_(parent_port), |
| 1843 package_root_(NULL), | 1846 package_root_(NULL), |
| 1844 library_url_(NULL), | 1847 library_url_(NULL), |
| 1845 class_name_(NULL), | 1848 class_name_(NULL), |
| 1846 function_name_(NULL), | 1849 function_name_(NULL), |
| 1847 serialized_args_(NULL), | 1850 serialized_args_(NULL), |
| 1848 serialized_args_len_(0), | 1851 serialized_args_len_(0), |
| 1849 serialized_message_(NULL), | 1852 serialized_message_(NULL), |
| 1850 serialized_message_len_(0), | 1853 serialized_message_len_(0), |
| 1851 paused_(paused) { | 1854 paused_(paused), |
| 1855 checked_(checkedFlag) { |
| 1852 script_url_ = strdup(script_url); | 1856 script_url_ = strdup(script_url); |
| 1853 if (package_root != NULL) { | 1857 if (package_root != NULL) { |
| 1854 package_root_ = strdup(package_root); | 1858 package_root_ = strdup(package_root); |
| 1855 } | 1859 } |
| 1856 library_url_ = NULL; | 1860 library_url_ = NULL; |
| 1857 function_name_ = strdup("main"); | 1861 function_name_ = strdup("main"); |
| 1858 bool can_send_any_object = false; | 1862 bool can_send_any_object = false; |
| 1859 SerializeObject(args, | 1863 SerializeObject(args, |
| 1860 &serialized_args_, | 1864 &serialized_args_, |
| 1861 &serialized_args_len_, | 1865 &serialized_args_len_, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 serialized_message_, serialized_message_len_); | 1961 serialized_message_, serialized_message_len_); |
| 1958 } | 1962 } |
| 1959 | 1963 |
| 1960 | 1964 |
| 1961 void IsolateSpawnState::Cleanup() { | 1965 void IsolateSpawnState::Cleanup() { |
| 1962 SwitchIsolateScope switch_scope(I); | 1966 SwitchIsolateScope switch_scope(I); |
| 1963 Dart::ShutdownIsolate(); | 1967 Dart::ShutdownIsolate(); |
| 1964 } | 1968 } |
| 1965 | 1969 |
| 1966 } // namespace dart | 1970 } // namespace dart |
| OLD | NEW |