Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1400)

Side by Side Diff: runtime/vm/isolate.cc

Issue 1527793004: Provide list of service protocol extensions in isolate and emit an event when one is registered (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 GrowableObjectArray& handlers =
1865 GrowableObjectArray::Handle(registered_service_extension_handlers());
1866 if (!handlers.IsNull()) {
1867 JSONArray extensions(&jsobj, "extensionRPCs");
1868 String& handler_name = String::Handle();
1869 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) {
1870 handler_name ^= handlers.At(i + kRegisteredNameIndex);
1871 extensions.AddValue(handler_name.ToCString());
1872 }
1873 }
1874 }
1862 } 1875 }
1863 1876
1864 1877
1865 void Isolate::set_tag_table(const GrowableObjectArray& value) { 1878 void Isolate::set_tag_table(const GrowableObjectArray& value) {
1866 tag_table_ = value.raw(); 1879 tag_table_ = value.raw();
1867 } 1880 }
1868 1881
1869 1882
1870 void Isolate::set_current_tag(const UserTag& tag) { 1883 void Isolate::set_current_tag(const UserTag& tag) {
1871 uword user_tag = tag.tag(); 1884 uword user_tag = tag.tag();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 // Sanity check. 2048 // Sanity check.
2036 const Instance& existing_handler = 2049 const Instance& existing_handler =
2037 Instance::Handle(LookupServiceExtensionHandler(name)); 2050 Instance::Handle(LookupServiceExtensionHandler(name));
2038 ASSERT(existing_handler.IsNull()); 2051 ASSERT(existing_handler.IsNull());
2039 } 2052 }
2040 #endif 2053 #endif
2041 ASSERT(kRegisteredNameIndex == 0); 2054 ASSERT(kRegisteredNameIndex == 0);
2042 handlers.Add(name, Heap::kOld); 2055 handlers.Add(name, Heap::kOld);
2043 ASSERT(kRegisteredHandlerIndex == 1); 2056 ASSERT(kRegisteredHandlerIndex == 1);
2044 handlers.Add(closure, Heap::kOld); 2057 handlers.Add(closure, Heap::kOld);
2058 {
2059 // Fire off an event.
2060 ServiceEvent event(this, ServiceEvent::kServiceExtensionAdded);
2061 event.set_extension_rpc(&name);
2062 Service::HandleEvent(&event);
2063 }
2045 } 2064 }
2046 2065
2047 2066
2048 // This function is written in C++ and not Dart because we must do this 2067 // 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 2068 // 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 2069 // to Dart code unless you can ensure that the operations will can be
2051 // done atomically. 2070 // done atomically.
2052 RawInstance* Isolate::LookupServiceExtensionHandler(const String& name) { 2071 RawInstance* Isolate::LookupServiceExtensionHandler(const String& name) {
2053 const GrowableObjectArray& handlers = 2072 const GrowableObjectArray& handlers =
2054 GrowableObjectArray::Handle(registered_service_extension_handlers()); 2073 GrowableObjectArray::Handle(registered_service_extension_handlers());
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 } 2510 }
2492 2511
2493 2512
2494 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { 2513 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) {
2495 return DeserializeObject(thread, 2514 return DeserializeObject(thread,
2496 serialized_message_, serialized_message_len_); 2515 serialized_message_, serialized_message_len_);
2497 } 2516 }
2498 2517
2499 2518
2500 } // namespace dart 2519 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/developer_extension_test.dart ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698