Skip to content
  • darin's avatar
    WebFoundation: · 8636c6f1
    darin authored
            Reviewed by Maciej.
    
    	- fixed most likely cause of 3125565 -- 2% regression running the PLT for uncached loads
    
            * Misc.subproj/WebNSUserDefaultsExtras.m:
            (+[NSUserDefaults _web_defaultsDidChange]): Added. Clears out cache when defaults change.
            (+[NSUserDefaults _web_addDefaultsChangeObserver]): Added. Sets up the above to run at the right time.
            (+[NSUserDefaults _web_acceptLanguageHeaderForPreferredLanguages]): Changed to cache the result in a
    	global and regenerate it when the global is cleared.
            (+[NSUserDefaults _web_preferredLanguageCode]): Ditto.
    
    WebKit:
    
            Reviewed by Maciej.
    
            - fixed most likely cause of 3125565 -- 2% regression running the PLT for uncached loads
    
            Don't recompute the user agent when it doesn't change. It almost never changes.
    
            * WebView.subproj/WebController.m:
            (-[WebController initWithView:controllerSetName:]): Add observer so we know when defaults change.
            (-[WebController dealloc]): Remove observer.
            (-[WebController setApplicationNameForUserAgent:]): Clear out computed user agent to force it
    	to be recomputed later.
            (-[WebController applicationNameForUserAgent]): Just retain since we copied when we stored it
    	so we know it's not mutable.
            (-[WebController customUserAgent]): Ditto.
            (-[WebController userAgentForURL:]): Use the cached user agent if it's good. Otherwise compute
    	and cache the user agent string. This means that we will almost never recompute it.
    
            * WebView.subproj/WebControllerPrivate.h: Add userAgent field to cache in.
            * WebView.subproj/WebControllerPrivate.m:
            (-[WebControllerPrivate dealloc]): Release userAgent.
            (-[WebController _defaultsDidChange]): Release and nil userAgent.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3019 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    8636c6f1