summaryrefslogtreecommitdiffstats
path: root/mojo/shell/scoped_message_pipe.cc
blob: 863e140b83e3498754f7fd2370ba8e0a5d8f7d18 (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
// Copyright 2013 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/shell/scoped_message_pipe.h"

namespace mojo {
namespace shell {

ScopedMessagePipe::ScopedMessagePipe()
    : handle_0_(MOJO_HANDLE_INVALID),
      handle_1_(MOJO_HANDLE_INVALID) {
  MojoCreateMessagePipe(&handle_0_, &handle_1_);
}

ScopedMessagePipe::~ScopedMessagePipe() {
  if (handle_0_ != MOJO_HANDLE_INVALID)
    MojoClose(handle_0_);

  if (handle_1_ != MOJO_HANDLE_INVALID)
    MojoClose(handle_1_);
}

}  // namespace shell
}  // namespace mojo