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

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

Issue 993613002: Implement 'print', 'up', 'down', and 'frame' commands in the Observatory debugger. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 5 years, 9 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/json_stream.cc ('k') | runtime/vm/service.h » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/message_handler.h" 5 #include "vm/message_handler.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 #include "vm/port.h" 9 #include "vm/port.h"
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 void MessageHandler::PostMessage(Message* message, bool before_events) { 96 void MessageHandler::PostMessage(Message* message, bool before_events) {
97 MonitorLocker ml(&monitor_); 97 MonitorLocker ml(&monitor_);
98 if (FLAG_trace_isolates) { 98 if (FLAG_trace_isolates) {
99 const char* source_name = "<native code>"; 99 const char* source_name = "<native code>";
100 Isolate* source_isolate = Isolate::Current(); 100 Isolate* source_isolate = Isolate::Current();
101 if (source_isolate) { 101 if (source_isolate) {
102 source_name = source_isolate->name(); 102 source_name = source_isolate->name();
103 } 103 }
104 OS::Print("[>] Posting message:\n" 104 OS::Print("[>] Posting message:\n"
105 "\tlen: %" Pd "\n"
105 "\tsource: %s\n" 106 "\tsource: %s\n"
106 "\tdest: %s\n" 107 "\tdest: %s\n"
107 "\tdest_port: %" Pd64 "\n", 108 "\tdest_port: %" Pd64 "\n",
108 source_name, name(), message->dest_port()); 109 message->len(), source_name, name(), message->dest_port());
109 } 110 }
110 111
111 Message::Priority saved_priority = message->priority(); 112 Message::Priority saved_priority = message->priority();
112 if (message->IsOOB()) { 113 if (message->IsOOB()) {
113 oob_queue_->Enqueue(message, before_events); 114 oob_queue_->Enqueue(message, before_events);
114 } else { 115 } else {
115 queue_->Enqueue(message, before_events); 116 queue_->Enqueue(message, before_events);
116 } 117 }
117 message = NULL; // Do not access message. May have been deleted. 118 message = NULL; // Do not access message. May have been deleted.
118 119
(...skipping 20 matching lines...) Expand all
139 bool MessageHandler::HandleMessages(bool allow_normal_messages, 140 bool MessageHandler::HandleMessages(bool allow_normal_messages,
140 bool allow_multiple_normal_messages) { 141 bool allow_multiple_normal_messages) {
141 // If isolate() returns NULL StartIsolateScope does nothing. 142 // If isolate() returns NULL StartIsolateScope does nothing.
142 StartIsolateScope start_isolate(isolate()); 143 StartIsolateScope start_isolate(isolate());
143 144
144 // TODO(turnidge): Add assert that monitor_ is held here. 145 // TODO(turnidge): Add assert that monitor_ is held here.
145 bool result = true; 146 bool result = true;
146 Message::Priority min_priority = (allow_normal_messages && !paused()) ? 147 Message::Priority min_priority = (allow_normal_messages && !paused()) ?
147 Message::kNormalPriority : Message::kOOBPriority; 148 Message::kNormalPriority : Message::kOOBPriority;
148 Message* message = DequeueMessage(min_priority); 149 Message* message = DequeueMessage(min_priority);
150 intptr_t message_len = message->len();
149 while (message != NULL) { 151 while (message != NULL) {
150 if (FLAG_trace_isolates) { 152 if (FLAG_trace_isolates) {
151 OS::Print("[<] Handling message:\n" 153 OS::Print("[<] Handling message:\n"
154 "\tlen: %" Pd "\n"
152 "\thandler: %s\n" 155 "\thandler: %s\n"
153 "\tport: %" Pd64 "\n", 156 "\tport: %" Pd64 "\n",
154 name(), message->dest_port()); 157 message_len, name(), message->dest_port());
155 } 158 }
156 159
157 // Release the monitor_ temporarily while we handle the message. 160 // Release the monitor_ temporarily while we handle the message.
158 // The monitor was acquired in MessageHandler::TaskCallback(). 161 // The monitor was acquired in MessageHandler::TaskCallback().
159 monitor_.Exit(); 162 monitor_.Exit();
160 Message::Priority saved_priority = message->priority(); 163 Message::Priority saved_priority = message->priority();
161 Dart_Port saved_dest_port = message->dest_port(); 164 Dart_Port saved_dest_port = message->dest_port();
162 result = HandleMessage(message); 165 result = HandleMessage(message);
163 message = NULL; // May be deleted by now. 166 message = NULL; // May be deleted by now.
164 monitor_.Enter(); 167 monitor_.Enter();
165 if (FLAG_trace_isolates) { 168 if (FLAG_trace_isolates) {
166 OS::Print("[.] Message handled:\n" 169 OS::Print("[.] Message handled:\n"
170 "\tlen: %" Pd "\n"
167 "\thandler: %s\n" 171 "\thandler: %s\n"
168 "\tport: %" Pd64 "\n", 172 "\tport: %" Pd64 "\n",
169 name(), saved_dest_port); 173 message_len, name(), saved_dest_port);
170 } 174 }
171 if (!result) { 175 if (!result) {
172 // If we hit an error, we're done processing messages. 176 // If we hit an error, we're done processing messages.
173 break; 177 break;
174 } 178 }
175 // Some callers want to process only one normal message and then quit. At 179 // Some callers want to process only one normal message and then quit. At
176 // the same time it is OK to process multiple OOB messages. 180 // the same time it is OK to process multiple OOB messages.
177 if ((saved_priority == Message::kNormalPriority) && 181 if ((saved_priority == Message::kNormalPriority) &&
178 !allow_multiple_normal_messages) { 182 !allow_multiple_normal_messages) {
179 break; 183 break;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 325
322 void MessageHandler::decrement_live_ports() { 326 void MessageHandler::decrement_live_ports() {
323 MonitorLocker ml(&monitor_); 327 MonitorLocker ml(&monitor_);
324 #if defined(DEBUG) 328 #if defined(DEBUG)
325 CheckAccess(); 329 CheckAccess();
326 #endif 330 #endif
327 live_ports_--; 331 live_ports_--;
328 } 332 }
329 333
330 } // namespace dart 334 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698