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

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

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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/tests/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 test {
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 void MessageQueue::Push(Message* message) {
26 queue_.push(new Message());
27 message->MoveTo(queue_.back());
28 }
29
30 void MessageQueue::Pop(Message* message) {
31 MOJO_DCHECK(!queue_.empty());
32 queue_.front()->MoveTo(message);
33 Pop();
34 }
35
36 void MessageQueue::Pop() {
37 MOJO_DCHECK(!queue_.empty());
38 delete queue_.front();
39 queue_.pop();
40 }
41
42 } // namespace test
43 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/message_queue.h ('k') | mojo/public/cpp/bindings/tests/request_response_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698