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

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

Issue 749373002: - Implement Isolate.ping. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/message_test.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) 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ASSERT(pool_ == NULL); 85 ASSERT(pool_ == NULL);
86 pool_ = pool; 86 pool_ = pool;
87 start_callback_ = start_callback; 87 start_callback_ = start_callback;
88 end_callback_ = end_callback; 88 end_callback_ = end_callback;
89 callback_data_ = data; 89 callback_data_ = data;
90 task_ = new MessageHandlerTask(this); 90 task_ = new MessageHandlerTask(this);
91 pool_->Run(task_); 91 pool_->Run(task_);
92 } 92 }
93 93
94 94
95 void MessageHandler::PostMessage(Message* message) { 95 void MessageHandler::PostMessage(Message* message, bool before_events) {
96 MonitorLocker ml(&monitor_); 96 MonitorLocker ml(&monitor_);
97 if (FLAG_trace_isolates) { 97 if (FLAG_trace_isolates) {
98 const char* source_name = "<native code>"; 98 const char* source_name = "<native code>";
99 Isolate* source_isolate = Isolate::Current(); 99 Isolate* source_isolate = Isolate::Current();
100 if (source_isolate) { 100 if (source_isolate) {
101 source_name = source_isolate->name(); 101 source_name = source_isolate->name();
102 } 102 }
103 OS::Print("[>] Posting message:\n" 103 OS::Print("[>] Posting message:\n"
104 "\tsource: %s\n" 104 "\tsource: %s\n"
105 "\tdest: %s\n" 105 "\tdest: %s\n"
106 "\tdest_port: %" Pd64 "\n", 106 "\tdest_port: %" Pd64 "\n",
107 source_name, name(), message->dest_port()); 107 source_name, name(), message->dest_port());
108 } 108 }
109 109
110 Message::Priority saved_priority = message->priority(); 110 Message::Priority saved_priority = message->priority();
111 if (message->IsOOB()) { 111 if (message->IsOOB()) {
112 oob_queue_->Enqueue(message); 112 oob_queue_->Enqueue(message, before_events);
113 } else { 113 } else {
114 queue_->Enqueue(message); 114 queue_->Enqueue(message, before_events);
115 } 115 }
116 message = NULL; // Do not access message. May have been deleted. 116 message = NULL; // Do not access message. May have been deleted.
117 117
118 if (pool_ != NULL && task_ == NULL) { 118 if (pool_ != NULL && task_ == NULL) {
119 task_ = new MessageHandlerTask(this); 119 task_ = new MessageHandlerTask(this);
120 pool_->Run(task_); 120 pool_->Run(task_);
121 } 121 }
122 122
123 // Invoke any custom message notification. 123 // Invoke any custom message notification.
124 MessageNotify(saved_priority); 124 MessageNotify(saved_priority);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 void MessageHandler::decrement_live_ports() { 307 void MessageHandler::decrement_live_ports() {
308 MonitorLocker ml(&monitor_); 308 MonitorLocker ml(&monitor_);
309 #if defined(DEBUG) 309 #if defined(DEBUG)
310 CheckAccess(); 310 CheckAccess();
311 #endif 311 #endif
312 live_ports_--; 312 live_ports_--;
313 } 313 }
314 314
315 } // namespace dart 315 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/message_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698