Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / mojo / public / bindings / lib / message.cc
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/message.h"
6
7 #include <stdlib.h>
8
9 #include <algorithm>
10
11 namespace mojo {
12
13 Message::Message()
14     : data(NULL) {
15 }
16
17 Message::~Message() {
18   free(data);
19
20   for (std::vector<Handle>::iterator it = handles.begin(); it != handles.end();
21        ++it) {
22     if (it->is_valid())
23       CloseRaw(*it);
24   }
25 }
26
27 void Message::Swap(Message* other) {
28   std::swap(data, other->data);
29   std::swap(handles, other->handles);
30 }
31
32 }  // namespace mojo