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

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

Issue 7461141: Rename BASE_API to BASE_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « base/mac/os_crash_dumps.h ('k') | base/mac/scoped_nsexception_enabler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_ 5 #ifndef BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_
6 #define BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_ 6 #define BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_api.h" 9 #include "base/base_export.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 11
12 #if defined(OS_MACOSX) 12 #if defined(OS_MACOSX)
13 #if defined(__OBJC__) 13 #if defined(__OBJC__)
14 @class NSAutoreleasePool; 14 @class NSAutoreleasePool;
15 #else // __OBJC__ 15 #else // __OBJC__
16 class NSAutoreleasePool; 16 class NSAutoreleasePool;
17 #endif // __OBJC__ 17 #endif // __OBJC__
18 #endif // OS_MACOSX 18 #endif // OS_MACOSX
19 19
20 namespace base { 20 namespace base {
21 namespace mac { 21 namespace mac {
22 22
23 // On the Mac, ScopedNSAutoreleasePool allocates an NSAutoreleasePool when 23 // On the Mac, ScopedNSAutoreleasePool allocates an NSAutoreleasePool when
24 // instantiated and sends it a -drain message when destroyed. This allows an 24 // instantiated and sends it a -drain message when destroyed. This allows an
25 // autorelease pool to be maintained in ordinary C++ code without bringing in 25 // autorelease pool to be maintained in ordinary C++ code without bringing in
26 // any direct Objective-C dependency. 26 // any direct Objective-C dependency.
27 // 27 //
28 // On other platforms, ScopedNSAutoreleasePool is an empty object with no 28 // On other platforms, ScopedNSAutoreleasePool is an empty object with no
29 // effects. This allows it to be used directly in cross-platform code without 29 // effects. This allows it to be used directly in cross-platform code without
30 // ugly #ifdefs. 30 // ugly #ifdefs.
31 class BASE_API ScopedNSAutoreleasePool { 31 class BASE_EXPORT ScopedNSAutoreleasePool {
32 public: 32 public:
33 #if !defined(OS_MACOSX) 33 #if !defined(OS_MACOSX)
34 ScopedNSAutoreleasePool() {} 34 ScopedNSAutoreleasePool() {}
35 void Recycle() { } 35 void Recycle() { }
36 #else // OS_MACOSX 36 #else // OS_MACOSX
37 ScopedNSAutoreleasePool(); 37 ScopedNSAutoreleasePool();
38 ~ScopedNSAutoreleasePool(); 38 ~ScopedNSAutoreleasePool();
39 39
40 // Clear out the pool in case its position on the stack causes it to be 40 // Clear out the pool in case its position on the stack causes it to be
41 // alive for long periods of time (such as the entire length of the app). 41 // alive for long periods of time (such as the entire length of the app).
42 // Only use then when you're certain the items currently in the pool are 42 // Only use then when you're certain the items currently in the pool are
43 // no longer needed. 43 // no longer needed.
44 void Recycle(); 44 void Recycle();
45 private: 45 private:
46 NSAutoreleasePool* autorelease_pool_; 46 NSAutoreleasePool* autorelease_pool_;
47 #endif // OS_MACOSX 47 #endif // OS_MACOSX
48 48
49 private: 49 private:
50 DISALLOW_COPY_AND_ASSIGN(ScopedNSAutoreleasePool); 50 DISALLOW_COPY_AND_ASSIGN(ScopedNSAutoreleasePool);
51 }; 51 };
52 52
53 } // namespace mac 53 } // namespace mac
54 } // namespace base 54 } // namespace base
55 55
56 #endif // BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_ 56 #endif // BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_
OLDNEW
« no previous file with comments | « base/mac/os_crash_dumps.h ('k') | base/mac/scoped_nsexception_enabler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698