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

Unified Diff: runtime/vm/message.h

Issue 9924015: Use the ThreadPool for all isolates and native ports. Previously, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
Index: runtime/vm/message.h
===================================================================
--- runtime/vm/message.h (revision 6423)
+++ runtime/vm/message.h (working copy)
@@ -67,90 +67,22 @@
void Enqueue(Message* msg);
- // Gets the next message from the message queue, possibly blocking
- // if no message is available. 'millis' is a timeout in
- // milliseconds. If 'millis' is 0, then this means to block
- // indefinitely. May block if no message is available. May return
- // NULL even if 'millis' is 0 due to spurious wakeups.
- Message* Dequeue(int64_t millis);
+ // Gets the next message from the message queue or NULL if no
+ // message is available.
siva 2012/04/14 00:29:53 Perhaps you should add in the comment that this do
turnidge 2012/04/17 23:46:55 Done.
+ Message* Dequeue();
- // Gets the next message from the message queue if available. Will
- // not block.
- Message* DequeueNoWait();
-
- // Gets the next message of the specified priority or greater from
- // the message queue if available. Will not block.
- Message* DequeueNoWaitWithPriority(Message::Priority min_priority);
-
void Flush(Dart_Port port);
void FlushAll();
private:
friend class MessageQueueTestPeer;
- Message* DequeueNoWaitHoldsLock(Message::Priority min_priority);
+ Message* head_;
+ Message* tail_;
- Monitor monitor_;
- Message* head_[Message::kNumPriorities];
- Message* tail_[Message::kNumPriorities];
-
DISALLOW_COPY_AND_ASSIGN(MessageQueue);
};
-// A MessageHandler is an entity capable of accepting messages.
-class MessageHandler {
- protected:
- MessageHandler();
-
- // Allows subclasses to provide custom message notification.
- virtual void MessageNotify(Message::Priority priority);
-
- public:
- virtual ~MessageHandler();
-
- // Allow subclasses to provide a handler name.
- virtual const char* name() const;
-
-#if defined(DEBUG)
- // Check that it is safe to access this message handler.
- //
- // For example, if this MessageHandler is an isolate, then it is
- // only safe to access it when the MessageHandler is the current
- // isolate.
- virtual void CheckAccess();
-#endif
-
- void PostMessage(Message* message);
- void ClosePort(Dart_Port port);
- void CloseAllPorts();
-
- // A message handler tracks how many live ports it has.
- bool HasLivePorts() const { return live_ports_ > 0; }
- void increment_live_ports() {
-#if defined(DEBUG)
- CheckAccess();
-#endif
- live_ports_++;
- }
- void decrement_live_ports() {
-#if defined(DEBUG)
- CheckAccess();
-#endif
- live_ports_--;
- }
-
- // Returns true if the handler is owned by the PortMap.
- //
- // This is used to delete handlers when their last live port is closed.
- virtual bool OwnedByPortMap() const { return false; }
-
- MessageQueue* queue() const { return queue_; }
-
- private:
- intptr_t live_ports_;
- MessageQueue* queue_;
-};
-
} // namespace dart
#endif // VM_MESSAGE_H_

Powered by Google App Engine
This is Rietveld 408576698