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

Side by Side Diff: base/mac/objc_property_releaser.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/mac_util.h ('k') | base/mac/os_crash_dumps.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_OBJC_PROPERTY_RELEASER_H_ 5 #ifndef BASE_MAC_OBJC_PROPERTY_RELEASER_H_
6 #define BASE_MAC_OBJC_PROPERTY_RELEASER_H_ 6 #define BASE_MAC_OBJC_PROPERTY_RELEASER_H_
7 #pragma once 7 #pragma once
8 8
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 10
11 #include "base/base_api.h" 11 #include "base/base_export.h"
12 12
13 namespace base { 13 namespace base {
14 namespace mac { 14 namespace mac {
15 15
16 // ObjCPropertyReleaser is a C++ class that can automatically release 16 // ObjCPropertyReleaser is a C++ class that can automatically release
17 // synthesized Objective-C properties marked "retain" or "copy". The expected 17 // synthesized Objective-C properties marked "retain" or "copy". The expected
18 // use is to place an ObjCPropertyReleaser object within an Objective-C class 18 // use is to place an ObjCPropertyReleaser object within an Objective-C class
19 // definition. When built with the -fobjc-call-cxx-cdtors compiler option, 19 // definition. When built with the -fobjc-call-cxx-cdtors compiler option,
20 // the ObjCPropertyReleaser's destructor will be called when the Objective-C 20 // the ObjCPropertyReleaser's destructor will be called when the Objective-C
21 // object that owns it is deallocated, and it will send a -release message to 21 // object that owns it is deallocated, and it will send a -release message to
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // notAProperty_ because it doesn't correspond to any declared @property. 76 // notAProperty_ because it doesn't correspond to any declared @property.
77 // 77 //
78 // Another way of doing this would be to provide a base class that others can 78 // Another way of doing this would be to provide a base class that others can
79 // inherit from, and to have the base class' -dealloc walk the property lists 79 // inherit from, and to have the base class' -dealloc walk the property lists
80 // of all subclasses in an object to send the -release messages. Since this 80 // of all subclasses in an object to send the -release messages. Since this
81 // involves a base reaching into its subclasses, it's deemed scary, so don't 81 // involves a base reaching into its subclasses, it's deemed scary, so don't
82 // do it. ObjCPropertyReleaser's design ensures that the property releaser 82 // do it. ObjCPropertyReleaser's design ensures that the property releaser
83 // will only operate on instance variables in the immediate object in which 83 // will only operate on instance variables in the immediate object in which
84 // the property releaser is placed. 84 // the property releaser is placed.
85 85
86 class BASE_API ObjCPropertyReleaser { 86 class BASE_EXPORT ObjCPropertyReleaser {
87 public: 87 public:
88 // ObjCPropertyReleaser can only be owned by an Objective-C object, so its 88 // ObjCPropertyReleaser can only be owned by an Objective-C object, so its
89 // memory is always guaranteed to be 0-initialized. Not defining the default 89 // memory is always guaranteed to be 0-initialized. Not defining the default
90 // constructor can prevent an otherwise no-op -.cxx_construct method from 90 // constructor can prevent an otherwise no-op -.cxx_construct method from
91 // showing up in Objective-C classes that contain a ObjCPropertyReleaser. 91 // showing up in Objective-C classes that contain a ObjCPropertyReleaser.
92 92
93 // Upon destruction (expected to occur from an Objective-C object's 93 // Upon destruction (expected to occur from an Objective-C object's
94 // -.cxx_destruct method), release all properties. 94 // -.cxx_destruct method), release all properties.
95 ~ObjCPropertyReleaser() { 95 ~ObjCPropertyReleaser() {
96 ReleaseProperties(); 96 ReleaseProperties();
(...skipping 22 matching lines...) Expand all
119 119
120 private: 120 private:
121 id object_; 121 id object_;
122 Class class_; 122 Class class_;
123 }; 123 };
124 124
125 } // namespace mac 125 } // namespace mac
126 } // namespace base 126 } // namespace base
127 127
128 #endif // BASE_MAC_OBJC_PROPERTY_RELEASER_H_ 128 #endif // BASE_MAC_OBJC_PROPERTY_RELEASER_H_
OLDNEW
« no previous file with comments | « base/mac/mac_util.h ('k') | base/mac/os_crash_dumps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698