- add sources.
[platform/framework/web/crosswalk.git] / src / mojo / shell / scoped_message_pipe.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/shell/scoped_message_pipe.h"
6
7 namespace mojo {
8 namespace shell {
9
10 ScopedMessagePipe::ScopedMessagePipe()
11     : handle_0_(MOJO_HANDLE_INVALID),
12       handle_1_(MOJO_HANDLE_INVALID) {
13   MojoCreateMessagePipe(&handle_0_, &handle_1_);
14 }
15
16 ScopedMessagePipe::~ScopedMessagePipe() {
17   if (handle_0_ != MOJO_HANDLE_INVALID)
18     MojoClose(handle_0_);
19
20   if (handle_1_ != MOJO_HANDLE_INVALID)
21     MojoClose(handle_1_);
22 }
23
24 }  // namespace shell
25 }  // namespace mojo