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

Side by Side Diff: runtime/vm/service.h

Issue 340443006: Add support for asynchronous event notification to the observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef VM_SERVICE_H_ 5 #ifndef VM_SERVICE_H_
6 #define VM_SERVICE_H_ 6 #define VM_SERVICE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 class DebuggerEvent;
14 class EmbedderServiceHandler; 15 class EmbedderServiceHandler;
15 class Instance; 16 class Instance;
16 class Isolate; 17 class Isolate;
17 class JSONStream; 18 class JSONStream;
18 class RawInstance; 19 class RawInstance;
20 class String;
19 21
20 class Service : public AllStatic { 22 class Service : public AllStatic {
21 public: 23 public:
22 // Handles a message which is not directed to an isolate. 24 // Handles a message which is not directed to an isolate.
23 static void HandleRootMessage(const Instance& message); 25 static void HandleRootMessage(const Instance& message);
24 26
25 // Handles a message which is directed to a particular isolate. 27 // Handles a message which is directed to a particular isolate.
26 static void HandleIsolateMessage(Isolate* isolate, const Instance& message); 28 static void HandleIsolateMessage(Isolate* isolate, const Instance& message);
27 29
28 static Isolate* GetServiceIsolate(void* callback_data); 30 static Isolate* GetServiceIsolate(void* callback_data);
29 static bool SendIsolateStartupMessage(); 31 static bool SendIsolateStartupMessage();
30 static bool SendIsolateShutdownMessage(); 32 static bool SendIsolateShutdownMessage();
31 static bool IsRunning(); 33
34 static bool IsRunning() {
35 return port_ != ILLEGAL_PORT;
36 }
37
38 static void SetEventMask(uint32_t mask);
39
40 // Is the service interested in debugger events?
41 static bool NeedsDebuggerEvents() {
42 return IsRunning() && ((event_mask_ & kEventFamilyDebugMask) != 0);
43 }
44
45 static void HandleDebuggerEvent(DebuggerEvent* event);
32 46
33 static void RegisterIsolateEmbedderCallback( 47 static void RegisterIsolateEmbedderCallback(
34 const char* name, 48 const char* name,
35 Dart_ServiceRequestCallback callback, 49 Dart_ServiceRequestCallback callback,
36 void* user_data); 50 void* user_data);
37 51
38 static void RegisterRootEmbedderCallback( 52 static void RegisterRootEmbedderCallback(
39 const char* name, 53 const char* name,
40 Dart_ServiceRequestCallback callback, 54 Dart_ServiceRequestCallback callback,
41 void* user_data); 55 void* user_data);
42 56
43 static bool IsServiceIsolate(Isolate* isolate) { 57 static bool IsServiceIsolate(Isolate* isolate) {
44 return isolate == service_isolate_; 58 return isolate == service_isolate_;
45 } 59 }
46 60
47 private: 61 private:
62 // These must be kept in sync with service/constants.dart
63 static const int kEventFamilyDebug = 0;
64 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug);
65
48 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, 66 static void EmbedderHandleMessage(EmbedderServiceHandler* handler,
49 JSONStream* js); 67 JSONStream* js);
50 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); 68 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name);
69 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name);
70 static Dart_Handle GetSource(const char* name);
71 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library,
72 Dart_Handle url);
73 static void SendEvent(intptr_t eventId, const String& eventMessage);
74
51 static EmbedderServiceHandler* isolate_service_handler_head_; 75 static EmbedderServiceHandler* isolate_service_handler_head_;
52 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name);
53 static EmbedderServiceHandler* root_service_handler_head_; 76 static EmbedderServiceHandler* root_service_handler_head_;
77
54 static Isolate* service_isolate_; 78 static Isolate* service_isolate_;
55 static Dart_LibraryTagHandler default_handler_; 79 static Dart_LibraryTagHandler default_handler_;
56 static Dart_Port port_; 80 static Dart_Port port_;
57 static Dart_Handle GetSource(const char* name); 81 static uint32_t event_mask_;
58 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library,
59 Dart_Handle url);
60 }; 82 };
61 83
62 } // namespace dart 84 } // namespace dart
63 85
64 #endif // VM_SERVICE_H_ 86 #endif // VM_SERVICE_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698