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

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 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
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::kServiceExtensionAdded);
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698