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

Side by Side Diff: mojo/public/bindings/lib/message_queue.h

Issue 65043004: Add better handle tracking, and optimize Connector::Accept. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update per review feedback Created 7 years, 1 month 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 | « mojo/public/bindings/lib/message.cc ('k') | mojo/public/bindings/lib/message_queue.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_QUEUE_H_ 5 #ifndef MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_QUEUE_H_
6 #define MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_QUEUE_H_ 6 #define MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_QUEUE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "mojo/public/system/macros.h" 10 #include "mojo/public/system/macros.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 13
14 class Message; 14 class Message;
15 15
16 // A queue for Message objects. 16 // A queue for Message objects.
17 class MessageQueue { 17 class MessageQueue {
18 public: 18 public:
19 MessageQueue(); 19 MessageQueue();
20 ~MessageQueue(); 20 ~MessageQueue();
21 21
22 bool IsEmpty() const; 22 bool IsEmpty() const;
23 const Message* Peek() const; 23 Message* Peek();
24 24
25 // This method transfers ownership of |message->data| and |message->handles| 25 // This method transfers ownership of |message->data| and |message->handles|
26 // to the message queue, resetting |message| in the process. 26 // to the message queue, resetting |message| in the process.
27 void Push(Message* message); 27 void Push(Message* message);
28 28
29 // Removes the next message from the queue, transferring ownership of its 29 // Removes the next message from the queue, transferring ownership of its
30 // data and handles to the given |message|. 30 // data and handles to the given |message|.
31 void Pop(Message* message); 31 void Pop(Message* message);
32 32
33 // Removes the next message from the queue, discarding its data and handles. 33 // Removes the next message from the queue, discarding its data and handles.
34 // This is meant to be used in conjunction with |Peek|. 34 // This is meant to be used in conjunction with |Peek|.
35 void Pop(); 35 void Pop();
36 36
37 private: 37 private:
38 std::queue<Message*> queue_; 38 std::queue<Message*> queue_;
39 39
40 MOJO_DISALLOW_COPY_AND_ASSIGN(MessageQueue); 40 MOJO_DISALLOW_COPY_AND_ASSIGN(MessageQueue);
41 }; 41 };
42 42
43 } // namespace mojo 43 } // namespace mojo
44 44
45 #endif // MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_QUEUE_H_ 45 #endif // MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_QUEUE_H_
OLDNEW
« no previous file with comments | « mojo/public/bindings/lib/message.cc ('k') | mojo/public/bindings/lib/message_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698