| Index: chrome/browser/cocoa/cookie_tree_node.mm
|
| ===================================================================
|
| --- chrome/browser/cocoa/cookie_tree_node.mm (revision 37852)
|
| +++ chrome/browser/cocoa/cookie_tree_node.mm (working copy)
|
| @@ -15,16 +15,8 @@
|
| if ((self = [super init])) {
|
| DCHECK(node);
|
| treeNode_ = node;
|
| + isLeaf_ = (node->GetChildCount() == 0);
|
|
|
| - const int childCount = node->GetChildCount();
|
| - children_.reset([[NSMutableArray alloc] initWithCapacity:childCount]);
|
| - for (int i = 0; i < childCount; ++i) {
|
| - CookieTreeNode* child = node->GetChild(i);
|
| - scoped_nsobject<CocoaCookieTreeNode> childNode(
|
| - [[CocoaCookieTreeNode alloc] initWithNode:child]);
|
| - [children_ addObject:childNode.get()];
|
| - }
|
| -
|
| [self rebuild];
|
| }
|
| return self;
|
| @@ -67,7 +59,7 @@
|
| }
|
|
|
| - (BOOL)isLeaf {
|
| - return ([children_ count] == 0);
|
| + return isLeaf_;
|
| }
|
|
|
| - (NSString*)title {
|
| @@ -75,6 +67,16 @@
|
| }
|
|
|
| - (NSMutableArray*)children {
|
| + if (!children_.get()) {
|
| + const int childCount = treeNode_->GetChildCount();
|
| + children_.reset([[NSMutableArray alloc] initWithCapacity:childCount]);
|
| + for (int i = 0; i < childCount; ++i) {
|
| + CookieTreeNode* child = treeNode_->GetChild(i);
|
| + scoped_nsobject<CocoaCookieTreeNode> childNode(
|
| + [[CocoaCookieTreeNode alloc] initWithNode:child]);
|
| + [children_ addObject:childNode.get()];
|
| + }
|
| + }
|
| return children_.get();
|
| }
|
|
|
|
|