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

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

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
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/cpp/bindings/lib/message_queue.h"
6
7 #include "mojo/public/cpp/bindings/message.h"
8 #include "mojo/public/cpp/environment/logging.h"
9
10 namespace mojo {
11 namespace internal {
12
13 MessageQueue::MessageQueue() {
14 }
15
16 MessageQueue::~MessageQueue() {
17 while (!queue_.empty())
18 Pop();
19 }
20
21 bool MessageQueue::IsEmpty() const {
22 return queue_.empty();
23 }
24
25 Message* MessageQueue::Peek() {
26 MOJO_DCHECK(!queue_.empty());
27 return queue_.front();
28 }
29
30 void MessageQueue::Push(Message* message) {
31 queue_.push(new Message());
32 queue_.back()->Swap(message);
33 }
34
35 void MessageQueue::Pop(Message* message) {
36 MOJO_DCHECK(!queue_.empty());
37 queue_.front()->Swap(message);
38 Pop();
39 }
40
41 void MessageQueue::Pop() {
42 MOJO_DCHECK(!queue_.empty());
43 delete queue_.front();
44 queue_.pop();
45 }
46
47 } // namespace internal
48 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/message_queue.h ('k') | mojo/public/cpp/bindings/lib/no_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698