Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: base/mac/scoped_mach_port.h

Issue 11188003: Fix some potential Mach port leaks from mach_host_self using a new ScopedMachPort class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 with MACH_PORT_NULL.
Mark Mentovai 2012/10/16 16:34:28 This is unused and can be gotten rid of.
Robert Sesek 2012/10/16 16:40:23 Done.
21 ScopedMachPort();
22
23 // Creates a scoper by taking ownership of the port.
24 explicit ScopedMachPort(mach_port_t port);
25
26 ~ScopedMachPort();
27
28 operator mach_port_t() const;
Mark Mentovai 2012/10/16 16:34:28 These two getters should remain inlined in the hea
Robert Sesek 2012/10/16 16:40:23 Done.
29 mach_port_t get() const;
30
31 private:
32 mach_port_t port_;
33
34 DISALLOW_COPY_AND_ASSIGN(ScopedMachPort);
35 };
36
37 } // namespace mac
38 } // namespace base
39
40 #endif // BASE_MAC_SCOPED_MACH_PORT_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/mac/scoped_mach_port.cc » ('j') | base/mac/scoped_mach_port.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698