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

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

Issue 867113003: Revert r43217, r43215, r43208, r43207, and r43202. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 #include "vm/os_thread.h"
12 11
13 namespace dart { 12 namespace dart {
14 13
15 class Array; 14 class Array;
16 class DebuggerEvent; 15 class DebuggerEvent;
17 class EmbedderServiceHandler; 16 class EmbedderServiceHandler;
18 class GCEvent; 17 class GCEvent;
19 class Instance; 18 class Instance;
20 class Isolate; 19 class Isolate;
21 class JSONStream; 20 class JSONStream;
22 class Object; 21 class Object;
23 class RawInstance; 22 class RawInstance;
24 class String; 23 class String;
25 24
26 class Service : public AllStatic { 25 class Service : public AllStatic {
27 public: 26 public:
28 static const char* kServiceIsolateName;
29 static bool IsServiceIsolateName(const char* name);
30
31 // Handles a message which is not directed to an isolate. 27 // Handles a message which is not directed to an isolate.
32 static void HandleRootMessage(const Instance& message); 28 static void HandleRootMessage(const Instance& message);
33 29
34 // Handles a message which is directed to a particular isolate. 30 // Handles a message which is directed to a particular isolate.
35 static void HandleIsolateMessage(Isolate* isolate, const Array& message); 31 static void HandleIsolateMessage(Isolate* isolate, const Array& message);
36 32
37 static Isolate* GetServiceIsolate(void* callback_data); 33 static Isolate* GetServiceIsolate(void* callback_data);
38 static bool SendIsolateStartupMessage(); 34 static bool SendIsolateStartupMessage();
39 static bool SendIsolateShutdownMessage(); 35 static bool SendIsolateShutdownMessage();
40 36
41 static bool IsRunning() { 37 static bool IsRunning() {
42 return port_ != ILLEGAL_PORT; 38 return port_ != ILLEGAL_PORT;
43 } 39 }
44 40
45 static void set_port(Dart_Port port) { 41 static void set_port(Dart_Port port) {
46 port_ = port; 42 port_ = port;
47 } 43 }
48 44
49 static Dart_Port WaitForLoadPort();
50 static bool IsServicePort(Dart_Port port) {
51 return (port == port_) || (port == load_port_);
52 }
53 static Dart_Port LoadPort();
54
55 static void SetLoadPort(Dart_Port port);
56
57 static void SetEventMask(uint32_t mask); 45 static void SetEventMask(uint32_t mask);
58 46
59 // Is the service interested in debugger events? 47 // Is the service interested in debugger events?
60 static bool NeedsDebuggerEvents() { 48 static bool NeedsDebuggerEvents() {
61 return IsRunning() && ((event_mask_ & kEventFamilyDebugMask) != 0); 49 return IsRunning() && ((event_mask_ & kEventFamilyDebugMask) != 0);
62 } 50 }
63 // Is the service interested in garbage collection events? 51 // Is the service interested in garbage collection events?
64 static bool NeedsGCEvents() { 52 static bool NeedsGCEvents() {
65 return IsRunning() && ((event_mask_ & kEventFamilyGCMask) != 0); 53 return IsRunning() && ((event_mask_ & kEventFamilyGCMask) != 0);
66 } 54 }
(...skipping 11 matching lines...) Expand all
78 Dart_ServiceRequestCallback callback, 66 Dart_ServiceRequestCallback callback,
79 void* user_data); 67 void* user_data);
80 68
81 static bool IsServiceIsolate(Isolate* isolate) { 69 static bool IsServiceIsolate(Isolate* isolate) {
82 return isolate == service_isolate_; 70 return isolate == service_isolate_;
83 } 71 }
84 72
85 static void SendEchoEvent(Isolate* isolate); 73 static void SendEchoEvent(Isolate* isolate);
86 static void SendGraphEvent(Isolate* isolate); 74 static void SendGraphEvent(Isolate* isolate);
87 75
88 static void MaybeInjectVMServiceLibrary(Isolate* isolate);
89
90 static void RunService();
91
92 static void FinishedInitializing();
93
94 private: 76 private:
95 // These must be kept in sync with service/constants.dart 77 // These must be kept in sync with service/constants.dart
96 static const int kEventFamilyDebug = 0; 78 static const int kEventFamilyDebug = 0;
97 static const int kEventFamilyGC = 1; 79 static const int kEventFamilyGC = 1;
98 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug); 80 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug);
99 static const uint32_t kEventFamilyGCMask = (1 << kEventFamilyGC); 81 static const uint32_t kEventFamilyGCMask = (1 << kEventFamilyGC);
100 82
101 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, 83 static void EmbedderHandleMessage(EmbedderServiceHandler* handler,
102 JSONStream* js); 84 JSONStream* js);
103
104 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); 85 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name);
105 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); 86 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name);
106 static Dart_Handle GetSource(const char* name); 87 static Dart_Handle GetSource(const char* name);
107 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, 88 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library,
108 Dart_Handle url); 89 Dart_Handle url);
109
110 static void SendEvent(intptr_t eventId, const Object& eventMessage); 90 static void SendEvent(intptr_t eventId, const Object& eventMessage);
111 // Does not take ownership of 'data'. 91 // Does not take ownership of 'data'.
112 static void SendEvent(intptr_t eventId, 92 static void SendEvent(intptr_t eventId,
113 const String& meta, 93 const String& meta,
114 const uint8_t* data, 94 const uint8_t* data,
115 intptr_t size); 95 intptr_t size);
116 96
117 static EmbedderServiceHandler* isolate_service_handler_head_; 97 static EmbedderServiceHandler* isolate_service_handler_head_;
118 static EmbedderServiceHandler* root_service_handler_head_; 98 static EmbedderServiceHandler* root_service_handler_head_;
119 99
120 static Isolate* service_isolate_; 100 static Isolate* service_isolate_;
101 static Dart_LibraryTagHandler embedder_provided_handler_;
121 static Dart_Port port_; 102 static Dart_Port port_;
122 static Monitor* monitor_;
123 static bool initializing_;
124 static Dart_Port load_port_;
125 static uint32_t event_mask_; 103 static uint32_t event_mask_;
126 }; 104 };
127 105
128 } // namespace dart 106 } // namespace dart
129 107
130 #endif // VM_SERVICE_H_ 108 #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