~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/chromium/src/base/mac/scoped_mach_port.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (c) 2012 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
 
#ifndef BASE_MAC_SCOPED_MACH_PORT_H_
6
 
#define BASE_MAC_SCOPED_MACH_PORT_H_
7
 
 
8
 
#include <mach/mach.h>
9
 
 
10
 
#include "base/basictypes.h"
11
 
#include "base/base_export.h"
12
 
 
13
 
namespace base {
14
 
namespace mac {
15
 
 
16
 
// A class for managing the life of a Mach port, releasing via
17
 
// mach_port_deallocate either its send and/or receive rights.
18
 
class BASE_EXPORT ScopedMachPort {
19
 
 public:
20
 
  // Creates a scoper by taking ownership of the port.
21
 
  explicit ScopedMachPort(mach_port_t port);
22
 
 
23
 
  ~ScopedMachPort();
24
 
 
25
 
  void reset(mach_port_t port = MACH_PORT_NULL);
26
 
 
27
 
  operator mach_port_t() const {
28
 
    return port_;
29
 
  }
30
 
 
31
 
  mach_port_t get() const {
32
 
    return port_;
33
 
  }
34
 
 
35
 
 private:
36
 
  mach_port_t port_;
37
 
 
38
 
  DISALLOW_COPY_AND_ASSIGN(ScopedMachPort);
39
 
};
40
 
 
41
 
}  // namespace mac
42
 
}  // namespace base
43
 
 
44
 
#endif  // BASE_MAC_SCOPED_MACH_PORT_H_