summaryrefslogtreecommitdiffstats
path: root/mojo/system/message_in_transit_queue.cc
blob: 48f77799e073757770489da943738a9e75b16b56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "mojo/system/message_in_transit_queue.h"

#include "base/logging.h"
#include "base/stl_util.h"

namespace mojo {
namespace system {

MessageInTransitQueue::MessageInTransitQueue() {
}

MessageInTransitQueue::MessageInTransitQueue(PassContents,
                                             MessageInTransitQueue* other) {
  queue_.swap(other->queue_);
}

MessageInTransitQueue::~MessageInTransitQueue() {
  if (!IsEmpty()) {
    LOG(WARNING) << "Destroying nonempty message queue";
    Clear();
  }
}

void MessageInTransitQueue::Clear() {
  STLDeleteElements(&queue_);
}

}  // namespace system
}  // namespace mojo