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

Side by Side Diff: base/mac/objc_property_releaser.mm

Issue 8368009: Replace most LOG statements with DLOG statements in base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « base/mac/mac_util.mm ('k') | base/message_loop.cc » ('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 #import "base/mac/objc_property_releaser.h" 5 #import "base/mac/objc_property_releaser.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void ObjCPropertyReleaser::Init(id object, Class classy) { 91 void ObjCPropertyReleaser::Init(id object, Class classy) {
92 DCHECK(!object_); 92 DCHECK(!object_);
93 DCHECK(!class_); 93 DCHECK(!class_);
94 CHECK([object isKindOfClass:classy]); 94 CHECK([object isKindOfClass:classy]);
95 95
96 object_ = object; 96 object_ = object;
97 class_ = classy; 97 class_ = classy;
98 } 98 }
99 99
100 void ObjCPropertyReleaser::ReleaseProperties() { 100 void ObjCPropertyReleaser::ReleaseProperties() {
101 CHECK(object_); 101 DCHECK(object_);
102 CHECK(class_); 102 DCHECK(class_);
103 103
104 unsigned int property_count = 0; 104 unsigned int property_count = 0;
105 objc_property_t* properties = class_copyPropertyList(class_, &property_count); 105 objc_property_t* properties = class_copyPropertyList(class_, &property_count);
106 106
107 for (unsigned int property_index = 0; 107 for (unsigned int property_index = 0;
108 property_index < property_count; 108 property_index < property_count;
109 ++property_index) { 109 ++property_index) {
110 objc_property_t property = properties[property_index]; 110 objc_property_t property = properties[property_index];
111 std::string instance_name = ReleasableInstanceName(property); 111 std::string instance_name = ReleasableInstanceName(property);
112 if (!instance_name.empty()) { 112 if (!instance_name.empty()) {
113 id instance_value = nil; 113 id instance_value = nil;
114 Ivar instance_variable = 114 Ivar instance_variable =
115 object_getInstanceVariable(object_, instance_name.c_str(), 115 object_getInstanceVariable(object_, instance_name.c_str(),
116 (void**)&instance_value); 116 (void**)&instance_value);
117 CHECK(instance_variable); 117 DCHECK(instance_variable);
118 [instance_value release]; 118 [instance_value release];
119 } 119 }
120 } 120 }
121 121
122 free(properties); 122 free(properties);
123 123
124 // Clear object_ and class_ in case this ObjCPropertyReleaser will live on. 124 // Clear object_ and class_ in case this ObjCPropertyReleaser will live on.
125 // It's only expected to release the properties it supervises once per Init. 125 // It's only expected to release the properties it supervises once per Init.
126 object_ = nil; 126 object_ = nil;
127 class_ = nil; 127 class_ = nil;
128 } 128 }
129 129
130 } // namespace mac 130 } // namespace mac
131 } // namespace base 131 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/mac_util.mm ('k') | base/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698