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

Unified Diff: chrome/browser/cocoa/cookie_tree_node.mm

Issue 561023: Merge 37695 - [Mac] Reduce jank in the cookie manager by lazily creating chil... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/307/src/
Patch Set: Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/cookie_tree_node.h ('k') | chrome/browser/cocoa/cookies_window_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « chrome/browser/cocoa/cookie_tree_node.h ('k') | chrome/browser/cocoa/cookies_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698