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 "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 } | 1852 } |
1853 { | 1853 { |
1854 JSONArray breakpoints(&jsobj, "breakpoints"); | 1854 JSONArray breakpoints(&jsobj, "breakpoints"); |
1855 debugger()->PrintBreakpointsToJSONArray(&breakpoints); | 1855 debugger()->PrintBreakpointsToJSONArray(&breakpoints); |
1856 } | 1856 } |
1857 | 1857 |
1858 { | 1858 { |
1859 JSONObject jssettings(&jsobj, "_debuggerSettings"); | 1859 JSONObject jssettings(&jsobj, "_debuggerSettings"); |
1860 debugger()->PrintSettingsToJSONObject(&jssettings); | 1860 debugger()->PrintSettingsToJSONObject(&jssettings); |
1861 } | 1861 } |
| 1862 |
| 1863 { |
| 1864 JSONArray extensions(&jsobj, "serviceExtensions"); |
| 1865 GrowableObjectArray& handlers = |
| 1866 GrowableObjectArray::Handle(registered_service_extension_handlers()); |
| 1867 String& handler_name = String::Handle(); |
| 1868 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) { |
| 1869 handler_name ^= handlers.At(i + kRegisteredNameIndex); |
| 1870 extensions.AddValue(handler_name.ToCString()); |
| 1871 } |
| 1872 } |
1862 } | 1873 } |
1863 | 1874 |
1864 | 1875 |
1865 void Isolate::set_tag_table(const GrowableObjectArray& value) { | 1876 void Isolate::set_tag_table(const GrowableObjectArray& value) { |
1866 tag_table_ = value.raw(); | 1877 tag_table_ = value.raw(); |
1867 } | 1878 } |
1868 | 1879 |
1869 | 1880 |
1870 void Isolate::set_current_tag(const UserTag& tag) { | 1881 void Isolate::set_current_tag(const UserTag& tag) { |
1871 uword user_tag = tag.tag(); | 1882 uword user_tag = tag.tag(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 // Sanity check. | 2046 // Sanity check. |
2036 const Instance& existing_handler = | 2047 const Instance& existing_handler = |
2037 Instance::Handle(LookupServiceExtensionHandler(name)); | 2048 Instance::Handle(LookupServiceExtensionHandler(name)); |
2038 ASSERT(existing_handler.IsNull()); | 2049 ASSERT(existing_handler.IsNull()); |
2039 } | 2050 } |
2040 #endif | 2051 #endif |
2041 ASSERT(kRegisteredNameIndex == 0); | 2052 ASSERT(kRegisteredNameIndex == 0); |
2042 handlers.Add(name, Heap::kOld); | 2053 handlers.Add(name, Heap::kOld); |
2043 ASSERT(kRegisteredHandlerIndex == 1); | 2054 ASSERT(kRegisteredHandlerIndex == 1); |
2044 handlers.Add(closure, Heap::kOld); | 2055 handlers.Add(closure, Heap::kOld); |
| 2056 { |
| 2057 // Fire off an event. |
| 2058 ServiceEvent event(this, ServiceEvent::kIsolateServiceExtensionRegistered); |
| 2059 event.set_extension_name(&name); |
| 2060 Service::HandleEvent(&event); |
| 2061 } |
2045 } | 2062 } |
2046 | 2063 |
2047 | 2064 |
2048 // This function is written in C++ and not Dart because we must do this | 2065 // This function is written in C++ and not Dart because we must do this |
2049 // operation atomically in the face of random OOB messages. Do not port | 2066 // operation atomically in the face of random OOB messages. Do not port |
2050 // to Dart code unless you can ensure that the operations will can be | 2067 // to Dart code unless you can ensure that the operations will can be |
2051 // done atomically. | 2068 // done atomically. |
2052 RawInstance* Isolate::LookupServiceExtensionHandler(const String& name) { | 2069 RawInstance* Isolate::LookupServiceExtensionHandler(const String& name) { |
2053 const GrowableObjectArray& handlers = | 2070 const GrowableObjectArray& handlers = |
2054 GrowableObjectArray::Handle(registered_service_extension_handlers()); | 2071 GrowableObjectArray::Handle(registered_service_extension_handlers()); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2491 } | 2508 } |
2492 | 2509 |
2493 | 2510 |
2494 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { | 2511 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { |
2495 return DeserializeObject(thread, | 2512 return DeserializeObject(thread, |
2496 serialized_message_, serialized_message_len_); | 2513 serialized_message_, serialized_message_len_); |
2497 } | 2514 } |
2498 | 2515 |
2499 | 2516 |
2500 } // namespace dart | 2517 } // namespace dart |
OLD | NEW |