зеркало из https://github.com/mozilla/gecko-dev.git
separate favicon change notifiaction into its own notification to avoid writes
to the disk. better spread out loading of favicons at startup. turn back on favicon support since startup perf issues resolved (bug 226140)
This commit is contained in:
Родитель
c257f932c2
Коммит
b61536c047
|
@ -76,5 +76,3 @@ pref("accessibility.typeaheadfind.autostart", false);
|
|||
|
||||
// image resizing
|
||||
pref("browser.enable_automatic_image_resizing", true);
|
||||
|
||||
pref("browser.chrome.favicons", false);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
// Notifications
|
||||
NSString *BookmarkItemChangedNotification = @"bi_cg";
|
||||
NSString *BookmarkIconChangedNotification = @"bicon_cg";
|
||||
|
||||
// all our saving/loading keys
|
||||
// Safari & Camino plist keys
|
||||
|
@ -220,7 +221,9 @@ NSString *CaminoTrueKey = @"true";
|
|||
[aIcon retain];
|
||||
[mIcon release];
|
||||
mIcon = aIcon;
|
||||
[self itemUpdatedNote];
|
||||
NSNotification *note = [NSNotification notificationWithName:BookmarkIconChangedNotification
|
||||
object:self userInfo:nil];
|
||||
[[NSNotificationCenter defaultCenter] postNotification:note];
|
||||
}
|
||||
|
||||
-(void) itemUpdatedNote
|
||||
|
@ -228,7 +231,6 @@ NSString *CaminoTrueKey = @"true";
|
|||
NSNotification *note = [NSNotification notificationWithName:BookmarkItemChangedNotification object:self userInfo:nil];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc postNotification:note];
|
||||
return;
|
||||
}
|
||||
|
||||
// stub functions to avoid warning
|
||||
|
|
|
@ -180,21 +180,26 @@ static unsigned gFirstUserCollection = 0;
|
|||
- (void)delayedStartupItems
|
||||
{
|
||||
[[NSApp delegate] setupBookmarkMenus:gBookmarksManager];
|
||||
|
||||
|
||||
// check update status of 1 bookmark every 2 minutes.
|
||||
mUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:kTimeToCheckAnotherBookmark target:self selector:@selector(checkForUpdates:) userInfo:nil repeats:YES];
|
||||
[mSmartFolderManager postStartupInitialization:self];
|
||||
[[self toolbarFolder] refreshIcon];
|
||||
|
||||
// load favicons (w/out hitting the network, cache only). Spread it out so that we only get
|
||||
// ten every three seconds to avoid locking up the UI with large bookmark lists.
|
||||
if ([[PreferenceManager sharedInstance] getBooleanPref:"browser.chrome.favicons" withSuccess:NULL]) {
|
||||
NSArray *allBookmarks = [[self rootBookmarks] allChildBookmarks];
|
||||
float delay = 3.0; //default value
|
||||
int count = [allBookmarks count];
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (i % 10 == 0)
|
||||
delay += 3.0;
|
||||
[[allBookmarks objectAtIndex:i] performSelector:@selector(refreshIcon) withObject:nil afterDelay:delay];
|
||||
}
|
||||
}
|
||||
// make sure bookmark toolbar was built (only a concern on startup from apple event)
|
||||
[[[[[NSApp delegate] getFrontmostBrowserWindow] windowController] bookmarkToolbar] buildButtonList];
|
||||
if ([[PreferenceManager sharedInstance] getBooleanPref:"browser.chrome.favicons" withSuccess:NULL]) {
|
||||
[[self toolbarFolder] refreshIcon];
|
||||
[[self bookmarkMenuFolder] performSelector:@selector(refreshIcon) withObject:nil afterDelay:3.0];
|
||||
[[self rendezvousFolder] performSelector:@selector(refreshIcon) withObject:nil afterDelay:10.0];
|
||||
[[self addressBookFolder] performSelector:@selector(refreshIcon) withObject:nil afterDelay:12.0];
|
||||
unsigned count = [mRootBookmarks count];
|
||||
for (unsigned i = gFirstUserCollection;i<count;i++)
|
||||
[[mRootBookmarks objectAtIndex:i] performSelector:@selector(refreshIcon) withObject:nil afterDelay:i];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)shutdown;
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
[nc addObserver:self selector:@selector(bookmarkAdded:) name:BookmarkFolderAdditionNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkRemoved:) name:BookmarkFolderDeletionNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkItemChangedNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkIconChangedNotification object:nil];
|
||||
if (aFolder == [[BookmarkManager sharedBookmarkManager] dockMenuFolder])
|
||||
[nc addObserver:self selector:@selector(dockMenuChanged:) name:BookmarkFolderDockMenuChangeNotificaton object:nil];
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
[nc addObserver:self selector:@selector(bookmarkAdded:) name:BookmarkFolderAdditionNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkRemoved:) name:BookmarkFolderDeletionNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkItemChangedNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkIconChangedNotification object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ const long kMinSearchPaneHeight = 80;
|
|||
[nc addObserver:self selector:@selector(bookmarkAdded:) name:BookmarkFolderAdditionNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkRemoved:) name:BookmarkFolderDeletionNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkItemChangedNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkIconChangedNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(serviceResolved:) name:NetworkServicesResolutionSuccess object:nil];
|
||||
// register for dragged types
|
||||
[mContainerPane registerForDraggedTypes:[NSArray arrayWithObject:@"MozBookmarkType"]];
|
||||
|
|
|
@ -58,6 +58,7 @@ extern NSString* BookmarkFolderChildIndexKey; // key for added object index in u
|
|||
extern NSString* BookmarkFolderDockMenuChangeNotificaton; //self is NEW dock menu OR nil
|
||||
// Defined in BookmarkItem.h
|
||||
extern NSString *BookmarkItemChangedNotification; //no userinfo, self is object
|
||||
extern NSString *BookmarkIconChangedNotification; //no userinfo, self is object
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver:self selector:@selector(bookmarkRemoved:) name:BookmarkFolderDeletionNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkItemChangedNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkIconChangedNotification object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче