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

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

Issue 220243007: Mojo: Move mojo/public/bindings/lib to mojo/public/cpp/bindings/lib. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/public/bindings/lib/message_queue.h ('k') | mojo/public/bindings/lib/router.h » ('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 2013 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 #include "mojo/public/bindings/lib/message_queue.h"
6
7 #include <assert.h>
8 #include <stddef.h>
9
10 #include "mojo/public/cpp/bindings/message.h"
11
12 namespace mojo {
13 namespace internal {
14
15 MessageQueue::MessageQueue() {
16 }
17
18 MessageQueue::~MessageQueue() {
19 while (!queue_.empty())
20 Pop();
21 }
22
23 bool MessageQueue::IsEmpty() const {
24 return queue_.empty();
25 }
26
27 Message* MessageQueue::Peek() {
28 assert(!queue_.empty());
29 return queue_.front();
30 }
31
32 void MessageQueue::Push(Message* message) {
33 queue_.push(new Message());
34 queue_.back()->Swap(message);
35 }
36
37 void MessageQueue::Pop(Message* message) {
38 assert(!queue_.empty());
39 queue_.front()->Swap(message);
40 Pop();
41 }
42
43 void MessageQueue::Pop() {
44 assert(!queue_.empty());
45 delete queue_.front();
46 queue_.pop();
47 }
48
49 } // namespace internal
50 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/bindings/lib/message_queue.h ('k') | mojo/public/bindings/lib/router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698