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

Side by Side Diff: mojo/edk/system/message_in_transit_queue.h

Issue 1649633002: Remove files that are no longer used in the Port EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « mojo/edk/system/message_in_transit.cc ('k') | mojo/edk/system/message_in_transit_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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_QUEUE_H_
6 #define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_QUEUE_H_
7
8 #include <stddef.h>
9
10 #include <deque>
11
12 #include "base/memory/scoped_ptr.h"
13 #include "mojo/edk/system/message_in_transit.h"
14 #include "mojo/edk/system/system_impl_export.h"
15 #include "mojo/public/cpp/system/macros.h"
16
17 namespace mojo {
18 namespace edk {
19
20 // A simple queue for |MessageInTransit|s (that owns its messages).
21 // This class is not thread-safe.
22 class MOJO_SYSTEM_IMPL_EXPORT MessageInTransitQueue {
23 public:
24 MessageInTransitQueue();
25 ~MessageInTransitQueue();
26
27 bool IsEmpty() const { return queue_.empty(); }
28 size_t Size() const { return queue_.size(); }
29
30 void AddMessage(scoped_ptr<MessageInTransit> message) {
31 queue_.push_back(message.release());
32 }
33
34 scoped_ptr<MessageInTransit> GetMessage() {
35 MessageInTransit* rv = queue_.front();
36 queue_.pop_front();
37 return make_scoped_ptr(rv);
38 }
39
40 const MessageInTransit* PeekMessage() const { return queue_.front(); }
41 MessageInTransit* PeekMessage() { return queue_.front(); }
42
43 void DiscardMessage() {
44 delete queue_.front();
45 queue_.pop_front();
46 }
47
48 void Clear();
49
50 // Efficiently swaps contents with |*other|.
51 void Swap(MessageInTransitQueue* other);
52
53 private:
54 // TODO(vtl): When C++11 is available, switch this to a deque of
55 // |scoped_ptr|/|unique_ptr|s.
56 std::deque<MessageInTransit*> queue_;
57
58 MOJO_DISALLOW_COPY_AND_ASSIGN(MessageInTransitQueue);
59 };
60
61 } // namespace edk
62 } // namespace mojo
63
64 #endif // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_QUEUE_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/message_in_transit.cc ('k') | mojo/edk/system/message_in_transit_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698