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

Unified Diff: runtime/vm/message_handler.cc

Issue 1122503003: Display isolate message queue in Observatory debugger (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/message_handler_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message_handler.cc
diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc
index 68344cb35db67ad979f96ade6edb381ee91f2d2d..34e3b40a2900d290dcd2011bd69f983b05865d9e 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -34,6 +34,7 @@ class MessageHandlerTask : public ThreadPool::Task {
MessageHandler::MessageHandler()
: queue_(new MessageQueue()),
oob_queue_(new MessageQueue()),
+ oob_message_handling_allowed_(true),
live_ports_(0),
paused_(0),
pause_on_start_(false),
@@ -208,6 +209,9 @@ bool MessageHandler::HandleNextMessage() {
bool MessageHandler::HandleOOBMessages() {
+ if (!oob_message_handling_allowed_) {
+ return true;
+ }
MonitorLocker ml(&monitor_);
#if defined(DEBUG)
CheckAccess();
@@ -333,4 +337,39 @@ void MessageHandler::decrement_live_ports() {
live_ports_--;
}
+
+MessageHandler::AcquiredQueues::AcquiredQueues()
+ : handler_(NULL) {
+}
+
+
+MessageHandler::AcquiredQueues::~AcquiredQueues() {
+ Reset(NULL);
+}
+
+
+void MessageHandler::AcquiredQueues::Reset(MessageHandler* handler) {
+ if (handler_ != NULL) {
+ // Release ownership. The OOB flag is set without holding the monitor.
+ handler_->monitor_.Exit();
+ handler_->oob_message_handling_allowed_ = true;
+ }
+ handler_ = handler;
+ if (handler_ == NULL) {
+ return;
+ }
+ ASSERT(handler_ != NULL);
+ // Take ownership. The OOB flag is set without holding the monitor.
+ handler_->oob_message_handling_allowed_ = false;
+ handler_->monitor_.Enter();
+}
+
+
+void MessageHandler::AcquireQueues(AcquiredQueues* acquired_queues) {
+ ASSERT(acquired_queues != NULL);
+ // No double dipping.
+ ASSERT(acquired_queues->handler_ == NULL);
+ acquired_queues->Reset(this);
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/message_handler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698