[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:36:04 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8bd7f871c5ff242f0f4429b82059b0220d2f504f
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Apr 10 16:54:03 2003 +0000

            Reviewed by Trey.
    
            - speed up startup by not calling [NSImage imageFileTypes] until we need to
    
            * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge frameRequiredForMIMEType:]):
            Call _viewClassForMIMEType instead of _viewTypes, since _viewClassForMIMEType is now optimized
            by not loading the image types unless needed.
    
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _representationClass]): Call _representationClassForMIMEType instead of
            _repTypes, since _representationClassForMIMEType is now optimized by not loading the image
            types unless needed.
            (+[WebDataSource _repTypesAllowImageTypeOmission:]): Added. Moved the guts of _repTypes
            in here. If you pass YES, doesn't bother adding the image types yet.
            (+[WebDataSource _repTypes]): Now calls _repTypesAllowImageTypeOmission:NO.
            (+[WebDataSource _representationClassForMIMEType:]): First try the dictionary without
            requiring the image types, then only in the case where we get nil, try with the image types.
    
            * WebView.subproj/WebFrameViewPrivate.m:
            (-[WebFrameView _makeDocumentViewForDataSource:]): Call _viewClassForMIMEType instead of
            _viewTypes, since _viewClassForMIMEType is now optimized by not loading the image types
            unless needed.
            (+[WebFrameView _viewTypesAllowImageTypeOmission:]): Added. Moved the guts of _viewTypes
            in here. If you pass YES, doesn't bother adding the image types yet.
            (+[WebFrameView _viewTypes]): Now calls _viewTypesAllowImageTypeOmission:NO.
            (+[WebFrameView _viewClassForMIMEType:]): First try the dictionary without requiring
            the image types, then only in the case where we get nil, try with the image types.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4060 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 714bee6..75a5f2c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,33 @@
+2003-04-10  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey.
+
+        - speed up startup by not calling [NSImage imageFileTypes] until we need to
+
+        * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge frameRequiredForMIMEType:]):
+        Call _viewClassForMIMEType instead of _viewTypes, since _viewClassForMIMEType is now optimized
+        by not loading the image types unless needed.
+
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _representationClass]): Call _representationClassForMIMEType instead of
+        _repTypes, since _representationClassForMIMEType is now optimized by not loading the image
+        types unless needed.
+        (+[WebDataSource _repTypesAllowImageTypeOmission:]): Added. Moved the guts of _repTypes
+        in here. If you pass YES, doesn't bother adding the image types yet.
+        (+[WebDataSource _repTypes]): Now calls _repTypesAllowImageTypeOmission:NO.
+        (+[WebDataSource _representationClassForMIMEType:]): First try the dictionary without
+        requiring the image types, then only in the case where we get nil, try with the image types.
+        
+        * WebView.subproj/WebFrameViewPrivate.m:
+        (-[WebFrameView _makeDocumentViewForDataSource:]): Call _viewClassForMIMEType instead of
+        _viewTypes, since _viewClassForMIMEType is now optimized by not loading the image types
+        unless needed.
+        (+[WebFrameView _viewTypesAllowImageTypeOmission:]): Added. Moved the guts of _viewTypes
+        in here. If you pass YES, doesn't bother adding the image types yet.
+        (+[WebFrameView _viewTypes]): Now calls _viewTypesAllowImageTypeOmission:NO.
+        (+[WebFrameView _viewClassForMIMEType:]): First try the dictionary without requiring
+        the image types, then only in the case where we get nil, try with the image types.
+
 2003-04-09  Trey Matteson  <trey at apple.com>
 
 	3223413 - crash in [CompletionController controlTextDidChange] at travelocity.com
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index d7b3bca..a1c1133 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -760,21 +760,21 @@ static BOOL loggedObjectCacheSize = NO;
     return cacheSize * multiplier;
 }
 
-- (BOOL)frameRequiredForMIMEType: (NSString*)mimeType
+- (BOOL)frameRequiredForMIMEType:(NSString*)mimeType
 {
     // Assume a plugin is required. Don't make a frame.
     if ([mimeType length] == 0)
         return NO;
     
-    Class result = [[WebFrameView _viewTypes] _web_objectForMIMEType: mimeType];
+    Class result = [WebFrameView _viewClassForMIMEType:mimeType];
     if (!result)
         return NO;  // Want to display a "plugin not found" dialog/image, so let a plugin get made.
         
     // If we're a supported type other than a plugin, we want to make a frame.
     // Ultimately we should just use frames for all mime types (plugins and HTML/XML/text documents),
     // but for now we're burdened with making a distinction between the two.
-    return !([result isSubclassOfClass: [WebNetscapePluginDocumentView class]] ||
-            [result conformsToProtocol: @protocol(WebPlugin)]);
+    return !([result isSubclassOfClass:[WebNetscapePluginDocumentView class]] ||
+            [result conformsToProtocol:@protocol(WebPlugin)]);
 }
 
 - (void)loadEmptyDocumentSynchronously
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 40b6a5d..84ca9e5 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -92,7 +92,7 @@
 
 - (Class)_representationClass
 {
-    return [[[self class] _repTypes] _web_objectForMIMEType:[[self response] MIMEType]];
+    return [[self class] _representationClassForMIMEType:[[self response] MIMEType]];
 }
 
 - (void)_setLoading:(BOOL)loading
@@ -438,10 +438,11 @@
     }
 }
 
-+ (NSMutableDictionary *)_repTypes
++ (NSMutableDictionary *)_repTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission
 {
     static NSMutableDictionary *repTypes = nil;
-
+    static BOOL addedImageTypes;
+    
     if (!repTypes) {
         repTypes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
             [WebHTMLRepresentation class], @"text/html",
@@ -451,20 +452,33 @@
             [WebTextRepresentation class], @"text/",
             [WebTextRepresentation class], @"application/x-javascript",
             nil];
-
+    }
+    
+    if (!addedImageTypes && !allowImageTypeOmission) {
         NSEnumerator *enumerator = [[WebImageView supportedImageMIMETypes] objectEnumerator];
         NSString *mime;
         while ((mime = [enumerator nextObject]) != nil) {
             [repTypes setObject:[WebImageRepresentation class] forKey:mime];
         }
+        addedImageTypes = YES;
     }
     
     return repTypes;
 }
 
++ (NSMutableDictionary *)_repTypes
+{
+    return [self _repTypesAllowImageTypeOmission:NO];
+}
+
 + (Class)_representationClassForMIMEType:(NSString *)MIMEType
 {
-    return [[self _repTypes] _web_objectForMIMEType:MIMEType];
+    // Getting the image types is slow, so don't do it until we have to.
+    Class c = [[self _repTypesAllowImageTypeOmission:YES] _web_objectForMIMEType:MIMEType];
+    if (c == nil) {
+        c = [[self _repTypes] _web_objectForMIMEType:MIMEType];
+    }
+    return c;
 }
 
 - (WebBridge *)_bridge
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.m b/WebKit/WebView.subproj/WebFrameViewPrivate.m
index e5fba5f..83cea00 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.m
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.m
@@ -85,7 +85,7 @@
 {
     NSString *MIMEType = [[dataSource response] MIMEType];
     
-    Class viewClass = [[[self class] _viewTypes] _web_objectForMIMEType:MIMEType];
+    Class viewClass = [[self class] _viewClassForMIMEType:MIMEType];
     NSView <WebDocumentView> *documentView = viewClass ? [[viewClass alloc] init] : nil;
     [self _setDocumentView:documentView];
     [documentView release];
@@ -244,9 +244,10 @@
     [self _scrollLineHorizontally: NO];
 }
 
-+ (NSMutableDictionary *)_viewTypes
++ (NSMutableDictionary *)_viewTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission
 {
     static NSMutableDictionary *viewTypes;
+    static BOOL addedImageTypes;
 
     if (!viewTypes) {
         viewTypes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
@@ -257,20 +258,33 @@
             [WebTextView class], @"text/",
             [WebTextView class], @"application/x-javascript",
             nil];
+    }
 
+    if (!addedImageTypes && !allowImageTypeOmission) {
         NSEnumerator *enumerator = [[WebImageView supportedImageMIMETypes] objectEnumerator];
         NSString *mime;
         while ((mime = [enumerator nextObject]) != nil) {
             [viewTypes setObject:[WebImageView class] forKey:mime];
         }
+        addedImageTypes = YES;
     }
     
     return viewTypes;
 }
 
++ (NSMutableDictionary *)_viewTypes
+{
+    return [self _viewTypesAllowImageTypeOmission:NO];
+}
+
 + (Class)_viewClassForMIMEType:(NSString *)MIMEType
 {
-    return [[self _viewTypes] _web_objectForMIMEType:MIMEType];
+    // Getting the image types is slow, so don't do it until we have to.
+    Class c = [[self _viewTypesAllowImageTypeOmission:YES] _web_objectForMIMEType:MIMEType];
+    if (c == nil) {
+        c = [[self _viewTypes] _web_objectForMIMEType:MIMEType];
+    }
+    return c;
 }
 
 - (void)_goBack

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list