Commit bf53f40f authored by sullivan's avatar sullivan
Browse files

WebKit:

	- to help with performance of various bookmark operations,
	added a call that returns the internal array of children,
	to complement the safer call that returns a copy.

        Reviewed by Darin

        * Bookmarks.subproj/WebBookmark.h:
	commented -children and new -rawChildren
        * Bookmarks.subproj/WebBookmark.m:
        (-[WebBookmark rawChildren]):
	new method, returns nil at this level.
        (-[WebBookmark contentMatches:]):
	use -rawChildren instead of -children

        * Bookmarks.subproj/WebBookmarkList.m:
        (-[WebBookmarkList rawChildren]):
	new method, returns internal array without copying

WebBrowser:

	- fixed 3129823 -- displaying many bookmarks in outline view is very slow

	Deployed new rawChildren call everywhere appropriate in WebBrowser. This
	prevents a lot of array-creation. On my machine, the time it takes to
	display a folder containing 1000 items went from 0.96 sec to 0.0084 sec.

        Reviewed by Darin

        * BookmarksController.m:
        (-[BookmarksController addChildrenOfBookmark:toMenu:]):
        (-[BookmarksController goToNthFavoriteLeaf:]):
        (-[BookmarksController _addBookmarksToMenu]):
        (-[BookmarksController mergeBookmarksFrom:to:]):
        (-[BookmarksController mergeBuiltInBookmarksIfNecessary]):
        (-[BookmarksController importInternetExplorerFavorites]):
        (-[BookmarksController updateBookmarkSources]):
        (-[BookmarksController favoriteBookmarks]):
        (-[BookmarksController addFavoriteBookmark:atIndex:]):
        (-[BookmarksController recursivelyAddChildFoldersOf:toMenu:withIndentationLevel:]):
	use -rawChildren instead of -children

        * BookmarksViewController.m:
        (-[BookmarksViewController newContentItemWithTitle:URLString:type:positionIgnoresSelection:]):
	use -rawChildren instead of -children
        (-[BookmarksViewController bookmarkSources]):
	use -rawChildren instead of -children
        (-[BookmarksViewController refreshContents]):
	log timing
        (-[BookmarksViewController canRemoveBookmarkSource:]):
	use -rawChildren instead of -children
        (-[BookmarksViewController deleteSelectedContentItems]):
	log timing
        (-[BookmarksViewController child:ofContentItem:usingSource:]):
	use -rawChildren instead of -children
        (-[BookmarksViewController outlineView:validateDrop:proposedItem:proposedChildIndex:]):
	use -rawChildren instead of -children
        (-[BookmarksViewController paste:]):
	log timing; use -rawChildren instead of -children
        (-[BookmarksViewController initWithBookmark:bookmark:]):
	use -rawChildren instead of -children

        (+[CompletionController _addBookmarkTree:]):
	use -rawChildren instead of -children
        (+[CompletionController _removeBookmarkTree:]):
	use -rawChildren instead of -children

        * FavoriteButton.m:
        (-[FavoriteButton _contentsMenu]):
	use -rawChildren instead of -children

        * WebBrowser.pbproj/project.pbxproj: version wars


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c2b370e1
......@@ -52,8 +52,15 @@ typedef enum {
- (void)setIdentifier:(NSString *)identifier;
// Array of child WebBookmarks. Returns nil if bookmarkType is not WebBookmarkTypeList.
// This creates a copy of the internal data structure, and thus is safe to (for example),
// iterate through, removing items from their parent as you go.
- (NSArray *)children;
// Array of child WebBookmarks. Returns nil if bookmarkType is not WebBookmarkTypeList.
// This returns the internal data structure itself. This array should not be modified,
// and operations that alter the children of this bookmark will affect the contents of this array.
- (NSArray *)rawChildren;
// Number of children. Returns 0 if bookmarkType is not WebBookmarkTypeList.
- (unsigned)numberOfChildren;
......
......@@ -87,6 +87,11 @@ - (NSArray *)children
return nil;
}
- (NSArray *)rawChildren
{
return nil;
}
- (unsigned)numberOfChildren
{
return 0;
......@@ -220,8 +225,8 @@ - (BOOL)contentMatches:(WebBookmark *)otherBookmark
unsigned childIndex;
for (childIndex = 0; childIndex < thisCount; ++childIndex) {
NSArray *theseChildren = [self children];
NSArray *thoseChildren = [otherBookmark children];
NSArray *theseChildren = [self rawChildren];
NSArray *thoseChildren = [otherBookmark rawChildren];
if (![[theseChildren objectAtIndex:childIndex] contentMatches:[thoseChildren objectAtIndex:childIndex]]) {
return NO;
}
......
......@@ -172,6 +172,11 @@ - (NSArray *)children
return [NSArray arrayWithArray:_list];
}
- (NSArray *)rawChildren
{
return _list;
}
- (unsigned)numberOfChildren
{
return [_list count];
......
2002-12-17 John Sullivan <sullivan@apple.com>
- to help with performance of various bookmark operations,
added a call that returns the internal array of children,
to complement the safer call that returns a copy.
Reviewed by Darin
* Bookmarks.subproj/WebBookmark.h:
commented -children and new -rawChildren
* Bookmarks.subproj/WebBookmark.m:
(-[WebBookmark rawChildren]):
new method, returns nil at this level.
(-[WebBookmark contentMatches:]):
use -rawChildren instead of -children
* Bookmarks.subproj/WebBookmarkList.m:
(-[WebBookmarkList rawChildren]):
new method, returns internal array without copying
2002-12-16 Darin Adler <darin@apple.com>
Reviewed by Don and Maciej.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment