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

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

Issue 871373012: Make service lifecycle checks thread safe (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 | « no previous file | 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"
(...skipping 20 matching lines...) Expand all
31 // Handles a message which is not directed to an isolate. 31 // Handles a message which is not directed to an isolate.
32 static void HandleRootMessage(const Instance& message); 32 static void HandleRootMessage(const Instance& message);
33 33
34 // Handles a message which is directed to a particular isolate. 34 // Handles a message which is directed to a particular isolate.
35 static void HandleIsolateMessage(Isolate* isolate, const Array& message); 35 static void HandleIsolateMessage(Isolate* isolate, const Array& message);
36 36
37 static Isolate* GetServiceIsolate(void* callback_data); 37 static Isolate* GetServiceIsolate(void* callback_data);
38 static bool SendIsolateStartupMessage(); 38 static bool SendIsolateStartupMessage();
39 static bool SendIsolateShutdownMessage(); 39 static bool SendIsolateShutdownMessage();
40 40
41 static bool IsRunning() { 41 static bool IsRunning();
42 return port_ != ILLEGAL_PORT; 42 static void SetServicePort(Dart_Port port);
43 } 43 static void SetServiceIsolate(Isolate* isolate);
44 44 static bool HasServiceIsolate();
45 static void set_port(Dart_Port port) { 45 static bool IsServiceIsolate(Isolate* isolate);
46 port_ = port;
47 }
48 46
49 static Dart_Port WaitForLoadPort(); 47 static Dart_Port WaitForLoadPort();
50 static bool IsServicePort(Dart_Port port) {
51 return (port == port_) || (port == load_port_);
52 }
53 static Dart_Port LoadPort(); 48 static Dart_Port LoadPort();
54
55 static void SetLoadPort(Dart_Port port); 49 static void SetLoadPort(Dart_Port port);
56 50
57 static void SetEventMask(uint32_t mask); 51 static void SetEventMask(uint32_t mask);
58 52
59 // Is the service interested in debugger events? 53 // Is the service interested in debugger events?
60 static bool NeedsDebuggerEvents() { 54 static bool NeedsDebuggerEvents() {
61 return IsRunning() && ((event_mask_ & kEventFamilyDebugMask) != 0); 55 return IsRunning() && ((event_mask_ & kEventFamilyDebugMask) != 0);
62 } 56 }
63 // Is the service interested in garbage collection events? 57 // Is the service interested in garbage collection events?
64 static bool NeedsGCEvents() { 58 static bool NeedsGCEvents() {
65 return IsRunning() && ((event_mask_ & kEventFamilyGCMask) != 0); 59 return IsRunning() && ((event_mask_ & kEventFamilyGCMask) != 0);
66 } 60 }
67 61
68 static void HandleDebuggerEvent(DebuggerEvent* event); 62 static void HandleDebuggerEvent(DebuggerEvent* event);
69 static void HandleGCEvent(GCEvent* event); 63 static void HandleGCEvent(GCEvent* event);
70 64
71 static void RegisterIsolateEmbedderCallback( 65 static void RegisterIsolateEmbedderCallback(
72 const char* name, 66 const char* name,
73 Dart_ServiceRequestCallback callback, 67 Dart_ServiceRequestCallback callback,
74 void* user_data); 68 void* user_data);
75 69
76 static void RegisterRootEmbedderCallback( 70 static void RegisterRootEmbedderCallback(
77 const char* name, 71 const char* name,
78 Dart_ServiceRequestCallback callback, 72 Dart_ServiceRequestCallback callback,
79 void* user_data); 73 void* user_data);
80 74
81 static bool IsServiceIsolate(Isolate* isolate) {
82 return isolate == service_isolate_;
83 }
84
85 static void SendEchoEvent(Isolate* isolate); 75 static void SendEchoEvent(Isolate* isolate);
86 static void SendGraphEvent(Isolate* isolate); 76 static void SendGraphEvent(Isolate* isolate);
87 77
88 static void MaybeInjectVMServiceLibrary(Isolate* isolate); 78 static void MaybeInjectVMServiceLibrary(Isolate* isolate);
89 79
90 static void RunService(); 80 static void RunService();
91 81
92 static void FinishedInitializing(); 82 static void FinishedInitializing();
93 83
94 private: 84 private:
(...skipping 15 matching lines...) Expand all
110 static void SendEvent(intptr_t eventId, const Object& eventMessage); 100 static void SendEvent(intptr_t eventId, const Object& eventMessage);
111 // Does not take ownership of 'data'. 101 // Does not take ownership of 'data'.
112 static void SendEvent(intptr_t eventId, 102 static void SendEvent(intptr_t eventId,
113 const String& meta, 103 const String& meta,
114 const uint8_t* data, 104 const uint8_t* data,
115 intptr_t size); 105 intptr_t size);
116 106
117 static EmbedderServiceHandler* isolate_service_handler_head_; 107 static EmbedderServiceHandler* isolate_service_handler_head_;
118 static EmbedderServiceHandler* root_service_handler_head_; 108 static EmbedderServiceHandler* root_service_handler_head_;
119 109
120 static Isolate* service_isolate_; 110
121 static Dart_Port port_;
122 static Monitor* monitor_; 111 static Monitor* monitor_;
123 static bool initializing_; 112 static bool initializing_;
113 static Isolate* service_isolate_;
114 static Dart_Port service_port_;
124 static Dart_Port load_port_; 115 static Dart_Port load_port_;
125 static uint32_t event_mask_; 116 static uint32_t event_mask_;
126 }; 117 };
127 118
128 } // namespace dart 119 } // namespace dart
129 120
130 #endif // VM_SERVICE_H_ 121 #endif // VM_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698