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

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

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « base/mac/scoped_mach_vm.cc ('k') | base/mac/scoped_nsautorelease_pool.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_NSAUTORELEASE_POOL_H_
6 #define BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_
7
8 #include "base/base_export.h"
9 #include "base/basictypes.h"
10
11 #if defined(__OBJC__)
12 @class NSAutoreleasePool;
13 #else // __OBJC__
14 class NSAutoreleasePool;
15 #endif // __OBJC__
16
17 namespace base {
18 namespace mac {
19
20 // ScopedNSAutoreleasePool allocates an NSAutoreleasePool when instantiated and
21 // sends it a -drain message when destroyed. This allows an autorelease pool to
22 // be maintained in ordinary C++ code without bringing in any direct Objective-C
23 // dependency.
24
25 class BASE_EXPORT ScopedNSAutoreleasePool {
26 public:
27 ScopedNSAutoreleasePool();
28 ~ScopedNSAutoreleasePool();
29
30 // Clear out the pool in case its position on the stack causes it to be
31 // alive for long periods of time (such as the entire length of the app).
32 // Only use then when you're certain the items currently in the pool are
33 // no longer needed.
34 void Recycle();
35 private:
36 NSAutoreleasePool* autorelease_pool_;
37
38 private:
39 DISALLOW_COPY_AND_ASSIGN(ScopedNSAutoreleasePool);
40 };
41
42 } // namespace mac
43 } // namespace base
44
45 #endif // BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_
OLDNEW
« no previous file with comments | « base/mac/scoped_mach_vm.cc ('k') | base/mac/scoped_nsautorelease_pool.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698