Changeset 219695 in webkit
- Timestamp:
- Jul 20, 2017 11:07:30 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj
r219484 r219695 138 138 5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F62710712B97007AA393 /* WebNavigationData.mm */; }; 139 139 51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */; }; 140 51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; };141 140 51C714FB0B20F79F00E5E33C /* WebBackForwardListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */; }; 142 141 51CBFCAD0D10E6C5002DBF51 /* WebCachedFramePlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */; }; … … 177 176 7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 178 177 7E6FEF0908985A7200C44C3F /* WebScriptDebugDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E6FEF0608985A7200C44C3F /* WebScriptDebugDelegate.mm */; }; 179 9304B3000B02341500F7850D /* WebIconDatabaseInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */; };180 178 931633EB0AEDFF930062B92D /* WebFrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 931633EA0AEDFF930062B92D /* WebFrameLoaderClient.h */; }; 181 179 931633EF0AEDFFAE0062B92D /* WebFrameLoaderClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 931633EE0AEDFFAE0062B92D /* WebFrameLoaderClient.mm */; }; … … 196 194 939810160824BF01008DF038 /* WebCoreStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = F59EAE3E0253C7EE018635CA /* WebCoreStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; }; 197 195 939810180824BF01008DF038 /* WebIconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = F528E3E9031E91AD01CA2ACA /* WebIconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 198 939810190824BF01008DF038 /* WebIconDatabasePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F528E3EB031E91AD01CA2ACA /* WebIconDatabasePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };199 196 9398101B0824BF01008DF038 /* WebKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 2568C72C0174912D0ECA149E /* WebKit.h */; settings = {ATTRIBUTES = (Private, ); }; }; 200 197 9398101C0824BF01008DF038 /* WebKitErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = F5927D4E02D26C5E01CA2DBB /* WebKitErrors.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 978 975 51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 979 976 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerInternal.h; sourceTree = "<group>"; }; 980 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseDelegate.h; sourceTree = "<group>"; };981 977 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListInternal.h; sourceTree = "<group>"; }; 982 978 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCachedFramePlatformData.h; sourceTree = "<group>"; }; … … 1052 1048 84AE905F062DE6A80075BBF9 /* WebDOMOperationsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDOMOperationsPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 1053 1049 84CA5F7E042685E800CA2ACA /* WebKitErrorsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitErrorsPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 1054 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseInternal.h; sourceTree = "<group>"; };1055 1050 930D02BB06275F640076701E /* WebViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 1056 1051 930D02BD06275F710076701E /* WebFrameInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 1571 1566 F528E3E9031E91AD01CA2ACA /* WebIconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabase.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 1572 1567 F528E3EA031E91AD01CA2ACA /* WebIconDatabase.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebIconDatabase.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 1573 F528E3EB031E91AD01CA2ACA /* WebIconDatabasePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabasePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };1574 1568 F53444CE02E87CBA018635CA /* WebKitStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitStatistics.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 1575 1569 F53444CF02E87CBA018635CA /* WebKitStatistics.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebKitStatistics.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 1792 1786 F528E3E9031E91AD01CA2ACA /* WebIconDatabase.h */, 1793 1787 F528E3EA031E91AD01CA2ACA /* WebIconDatabase.mm */, 1794 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */,1795 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */,1796 F528E3EB031E91AD01CA2ACA /* WebIconDatabasePrivate.h */,1797 1788 2568C72C0174912D0ECA149E /* WebKit.h */, 1798 1789 F5927D4E02D26C5E01CA2DBB /* WebKitErrors.h */, … … 3064 3055 939810180824BF01008DF038 /* WebIconDatabase.h in Headers */, 3065 3056 51494CD60C7EBDE0004178C5 /* WebIconDatabaseClient.h in Headers */, 3066 51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */,3067 9304B3000B02341500F7850D /* WebIconDatabaseInternal.h in Headers */,3068 939810190824BF01008DF038 /* WebIconDatabasePrivate.h in Headers */,3069 3057 9321D5921A391DC3008052BE /* WebImmediateActionController.h in Headers */, 3070 3058 A560946614D8AD2600799A8A /* WebIndicateLayer.h in Headers */, … … 3238 3226 LastUpgradeCheck = 0700; 3239 3227 }; 3240 buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit " */;3228 buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKitLegacy" */; 3241 3229 compatibilityVersion = "Xcode 3.2"; 3242 3230 developmentRegion = English; … … 3811 3799 defaultConfigurationName = Production; 3812 3800 }; 3813 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit " */ = {3801 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKitLegacy" */ = { 3814 3802 isa = XCConfigurationList; 3815 3803 buildConfigurations = ( -
trunk/Source/WebKitLegacy/mac/ChangeLog
r219648 r219695 1 2017-07-20 Brady Eidson <beidson@apple.com> 2 3 Deprecate WebIconDatabase in WebKitLegacy/mac. 4 https://bugs.webkit.org/show_bug.cgi?id=174607 5 6 Reviewed by Alex Christensen. 7 8 This patch: 9 1 - Formally deprecates WebIconDatabase (which was never API anyways) 10 2 - Guts the class to where it can only return the default icon at the small size 11 3 - Reworks other parts of WebKitLegacy that used it for anything to either 12 use something else or to not do anything. 13 14 This patch *could* go much farther. A future patch is what will remove WebCore/IconDatabase 15 and that patch will remove all of the last remnants of WebIconDatabase. 16 17 * History/WebHistoryItem.mm: 18 (-[WebHistoryItem icon]): 19 20 * Misc/WebIconDatabase.h: 21 * Misc/WebIconDatabase.mm: 22 (-[WebIconDatabase init]): 23 (-[WebIconDatabase iconForURL:withSize:cache:]): 24 (-[WebIconDatabase iconForURL:withSize:]): 25 (-[WebIconDatabase defaultIconWithSize:]): 26 (-[WebIconDatabase defaultIconForURL:withSize:]): 27 (-[WebIconDatabase iconURLForURL:]): 28 (-[WebIconDatabase retainIconForURL:]): 29 (-[WebIconDatabase releaseIconForURL:]): 30 (+[WebIconDatabase delayDatabaseCleanup]): 31 (+[WebIconDatabase allowDatabaseCleanup]): 32 (-[WebIconDatabase setDelegate:]): 33 (-[WebIconDatabase delegate]): 34 (+[WebIconDatabase initialize]): Deleted. 35 (-[WebIconDatabase isEnabled]): Deleted. 36 (-[WebIconDatabase setEnabled:]): Deleted. 37 (-[WebIconDatabase removeAllIcons]): Deleted. 38 (+[WebIconDatabase _checkIntegrityBeforeOpening]): Deleted. 39 (-[WebIconDatabase _sendNotificationForURL:]): Deleted. 40 (-[WebIconDatabase _sendDidRemoveAllIconsNotification]): Deleted. 41 (-[WebIconDatabase _startUpIconDatabase]): Deleted. 42 (-[WebIconDatabase _shutDownIconDatabase]): Deleted. 43 (-[WebIconDatabase _applicationWillTerminate:]): Deleted. 44 (-[WebIconDatabase _iconForFileURL:withSize:]): Deleted. 45 (-[WebIconDatabase _resetCachedWebPreferences:]): Deleted. 46 (-[WebIconDatabase _largestIconFromDictionary:]): Deleted. 47 (-[WebIconDatabase _iconsBySplittingRepresentationsOfIcon:]): Deleted. 48 (-[WebIconDatabase _iconFromDictionary:forSize:cache:]): Deleted. 49 (-[WebIconDatabase _scaleIcon:toSize:]): Deleted. 50 (-[WebIconDatabase _databaseDirectory]): Deleted. 51 (webGetNSImage): Deleted. 52 53 * Misc/WebIconDatabaseDelegate.h: Removed. 54 * Misc/WebIconDatabaseInternal.h: Removed. 55 * Misc/WebIconDatabasePrivate.h: Removed. 56 57 * WebCoreSupport/WebFrameLoaderClient.mm: 58 (webGetNSImage): 59 60 * WebCoreSupport/WebIconDatabaseClient.mm: 61 (WebIconDatabaseClient::didRemoveAllIcons): 62 (WebIconDatabaseClient::didImportIconURLForPageURL): 63 64 * WebView/WebView.mm: 65 (-[WebView setFrameLoadDelegate:]): 66 (-[WebView mainFrameIcon]): 67 1 68 2017-07-18 Andy Estes <aestes@apple.com> 2 69 -
trunk/Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig
r219155 r219695 25 25 #include "Version.xcconfig" 26 26 27 EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *.defs *.nib *.pdf *.tiff CarbonUtils.* CarbonWindowAdapter.* CarbonWindowContentView.* CarbonWindowFrame.* HIViewAdapter.* HIWebView.* OutlookQuirksUserScript.js PopupMenuMac.* SearchPopupMenuMac.* WebClipView.* WebDashboardRegion.* WebDynamicScrollBarsView.* WebIconDatabase.* WebI conDatabasePrivate.* WebInspectorClient.* WebJavaScriptTextInputPanel.* WebNSEventExtras.* WebNSPasteboardExtras.* WebNSWindowExtras.* WebPanelAuthenticationHandler.* WebPluginsPrivate.* WebStringTruncator.* WebTextCompletionController.*;27 EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *.defs *.nib *.pdf *.tiff CarbonUtils.* CarbonWindowAdapter.* CarbonWindowContentView.* CarbonWindowFrame.* HIViewAdapter.* HIWebView.* OutlookQuirksUserScript.js PopupMenuMac.* SearchPopupMenuMac.* WebClipView.* WebDashboardRegion.* WebDynamicScrollBarsView.* WebIconDatabase.* WebInspectorClient.* WebJavaScriptTextInputPanel.* WebNSEventExtras.* WebNSPasteboardExtras.* WebNSWindowExtras.* WebPanelAuthenticationHandler.* WebPluginsPrivate.* WebStringTruncator.* WebTextCompletionController.*; 28 28 EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = *IOS.mm MemoryMeasure.h WebCaretChangeListener.h WebFixedPositionContent.h WebFrameIOS.h WebFrameIPhone.h WebGeolocationCoreLocationProvider.h WebGeolocationPrivate.h WebGeolocationProviderIOS.h WebMIMETypeRegistry.h WebNSStringExtrasIOS.h WebNSStringExtrasIPhone.h WebPDFViewIOS.h WebPDFViewIPhone.h WebPDFViewPlaceholder.h WebSelectionRect.h WebUIKitDelegate.h WebUIKitSupport.h WebVisiblePosition.h DOMHTMLTextAreaElementPrivate.h DOMUIKitExtensions.h; 29 29 -
trunk/Source/WebKitLegacy/mac/History/WebHistoryItem.mm
r219057 r219695 200 200 - (NSImage *)icon 201 201 { 202 #pragma GCC diagnostic push 203 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 202 204 return [[WebIconDatabase sharedIconDatabase] iconForURL:[self URLString] withSize:WebIconSmallSize]; 205 #pragma GCC diagnostic pop 203 206 } 204 207 #endif -
trunk/Source/WebKitLegacy/mac/Misc/WebIconDatabase.h
r207934 r219695 33 33 #endif 34 34 35 // Sent whenever a site icon has changed. The object of the notification is the icon database. 36 // The userInfo contains the site URL whose icon has changed. 37 // It can be accessed with the key WebIconNotificationUserInfoURLKey. 35 #define ICON_DATABASE_DEPRECATED __deprecated_msg("WebIconDatabase is not API and no longer handles icon loading. It will be removed in a future release.") 36 38 37 extern NSString *WebIconDatabaseDidAddIconNotification; 39 38 … … 66 65 Retention methods can be called for icons that are not yet in the database. 67 66 */ 67 68 ICON_DATABASE_DEPRECATED 68 69 @interface WebIconDatabase : NSObject { 69 70 … … 77 78 @abstract Returns a shared instance of the icon database 78 79 */ 79 + (WebIconDatabase *)sharedIconDatabase ;80 + (WebIconDatabase *)sharedIconDatabase ICON_DATABASE_DEPRECATED; 80 81 81 82 #if !TARGET_OS_IPHONE … … 84 85 @discussion Calls iconForURL:withSize:cache: with YES for cache. 85 86 */ 86 - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size ;87 - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size ICON_DATABASE_DEPRECATED; 87 88 88 89 /*! … … 93 94 @param cache If yes, caches the returned image in memory if not already cached 94 95 */ 95 - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size cache:(BOOL)cache ;96 - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size cache:(BOOL)cache ICON_DATABASE_DEPRECATED; 96 97 #endif 97 98 … … 100 101 @discussion Returns an icon URL for a web site URL from memory or disk. nil if none is found. 101 102 */ 102 - (NSString *)iconURLForURL:(NSString *)URL ;103 - (NSString *)iconURLForURL:(NSString *)URL ICON_DATABASE_DEPRECATED; 103 104 104 105 #if !TARGET_OS_IPHONE … … 106 107 @method defaultIconWithSize: 107 108 */ 108 - (NSImage *)defaultIconWithSize:(NSSize)size ;109 - (NSImage *)defaultIconForURL:(NSString *)URL withSize:(NSSize)size ;109 - (NSImage *)defaultIconWithSize:(NSSize)size ICON_DATABASE_DEPRECATED; 110 - (NSImage *)defaultIconForURL:(NSString *)URL withSize:(NSSize)size ICON_DATABASE_DEPRECATED; 110 111 #endif 111 112 … … 114 115 @abstract Increments the retain count of the icon. 115 116 */ 116 - (void)retainIconForURL:(NSString *)URL ;117 - (void)retainIconForURL:(NSString *)URL ICON_DATABASE_DEPRECATED; 117 118 118 119 /*! … … 120 121 @abstract Decrements the retain count of the icon. 121 122 */ 122 - (void)releaseIconForURL:(NSString *)URL ;123 - (void)releaseIconForURL:(NSString *)URL ICON_DATABASE_DEPRECATED; 123 124 124 125 /*! … … 128 129 The counter equals 0 at initialization. 129 130 */ 130 + (void)delayDatabaseCleanup ;131 + (void)delayDatabaseCleanup ICON_DATABASE_DEPRECATED; 131 132 132 133 /*! … … 136 137 The counter equals 0 at initialization. 137 138 */ 138 + (void)allowDatabaseCleanup ;139 + (void)allowDatabaseCleanup ICON_DATABASE_DEPRECATED; 139 140 140 - (void)setDelegate:(id)delegate ;141 - (id)delegate ;141 - (void)setDelegate:(id)delegate ICON_DATABASE_DEPRECATED; 142 - (id)delegate ICON_DATABASE_DEPRECATED; 142 143 143 144 @end -
trunk/Source/WebKitLegacy/mac/Misc/WebIconDatabase.mm
r219200 r219695 29 29 #if !PLATFORM(IOS) 30 30 31 #import "WebIconDatabase Internal.h"31 #import "WebIconDatabase.h" 32 32 33 #import "WebIconDatabaseClient.h"34 #import "WebIconDatabaseDelegate.h"35 #import "WebKitLogging.h"36 #import "WebKitNSStringExtras.h"37 33 #import "WebKitVersionChecks.h" 38 #import "WebNSFileManagerExtras.h"39 #import "WebNSURLExtras.h"40 #import "WebPreferencesPrivate.h"41 #import "WebTypesInternal.h"42 #import <WebCore/IconDatabase.h>43 34 #import <WebCore/Image.h> 44 #import <WebCore/IntSize.h>45 #import <WebCore/SharedBuffer.h>46 35 #import <WebCore/ThreadCheck.h> 47 36 #import <runtime/InitializeThreading.h> 48 37 #import <wtf/MainThread.h> 38 #import <wtf/NeverDestroyed.h> 49 39 #import <wtf/RunLoop.h> 50 40 … … 64 54 NSSize WebIconLargeSize = {128, 128}; 65 55 66 #define UniqueFilePathSize (34) 67 68 static WebIconDatabaseClient* defaultClient() 69 { 70 #if ENABLE(ICONDATABASE) 71 static WebIconDatabaseClient* defaultClient = new WebIconDatabaseClient(); 72 return defaultClient; 73 #else 74 return 0; 75 #endif 76 } 77 78 @interface WebIconDatabase (WebReallyInternal) 79 - (void)_sendNotificationForURL:(NSString *)URL; 80 - (void)_sendDidRemoveAllIconsNotification; 81 - (NSImage *)_iconForFileURL:(NSString *)fileURL withSize:(NSSize)size; 82 - (void)_resetCachedWebPreferences:(NSNotification *)notification; 83 - (NSImage *)_largestIconFromDictionary:(NSMutableDictionary *)icons; 84 - (NSMutableDictionary *)_iconsBySplittingRepresentationsOfIcon:(NSImage *)icon; 85 - (NSImage *)_iconFromDictionary:(NSMutableDictionary *)icons forSize:(NSSize)size cache:(BOOL)cache; 86 - (void)_scaleIcon:(NSImage *)icon toSize:(NSSize)size; 87 - (NSString *)_databaseDirectory; 88 @end 56 static const unsigned char defaultIconData[] = { 0x4D, 0x4D, 0x00, 0x2A, 0x00, 0x00, 0x03, 0x32, 0x80, 0x00, 0x20, 0x50, 0x38, 0x24, 0x16, 0x0D, 0x07, 0x84, 0x42, 0x61, 0x50, 0xB8, 57 0x64, 0x08, 0x18, 0x0D, 0x0A, 0x0B, 0x84, 0xA2, 0xA1, 0xE2, 0x08, 0x5E, 0x39, 0x28, 0xAF, 0x48, 0x24, 0xD3, 0x53, 0x9A, 0x37, 0x1D, 0x18, 0x0E, 0x8A, 0x4B, 0xD1, 0x38, 58 0xB0, 0x7C, 0x82, 0x07, 0x03, 0x82, 0xA2, 0xE8, 0x6C, 0x2C, 0x03, 0x2F, 0x02, 0x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x9B, 0x08, 0xDC, 0x5B, 0x02, 0xA1, 0x30, 0x7E, 0x3C, 0xEE, 0x5B, 0xA6, 0xDD, 0xB8, 85 0x6D, 0x5B, 0x62, 0xB7, 0xCD, 0xF3, 0x9C, 0xEA, 0x04, 0x80, 0x80, 0x00, 0x00, 0x0E, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x01, 0x01, 86 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0xE0, 0x01, 0x03, 0x00, 0x03, 0x00, 0x00, 87 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x01, 0x06, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x01, 0x11, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 88 0x00, 0x08, 0x01, 0x15, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x16, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 89 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x29, 0x01, 0x1A, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0xE8, 0x01, 0x1B, 0x00, 0x05, 0x00, 0x00, 90 0x00, 0x01, 0x00, 0x00, 0x03, 0xF0, 0x01, 0x1C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x28, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 91 0x00, 0x00, 0x01, 0x52, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0A, 92 0xFC, 0x80, 0x00, 0x00, 0x27, 0x10, 0x00, 0x0A, 0xFC, 0x80, 0x00, 0x00, 0x27, 0x10 }; 89 93 90 94 @implementation WebIconDatabase … … 113 117 - (id)init 114 118 { 115 self = [super init];116 if (!self)117 return nil;118 119 WebCoreThreadViolationCheckRoundOne(); 119 120 _private = [[WebIconDatabasePrivate alloc] init]; 121 122 // Check the user defaults and see if the icon database should even be enabled. 123 // Inform the bridge and, if we're disabled, bail from init right here 124 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 125 // <rdar://problem/4741419> - IconDatabase should be disabled by default 126 NSDictionary *initialDefaults = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], WebIconDatabaseEnabledDefaultsKey, nil]; 127 [defaults registerDefaults:initialDefaults]; 128 [initialDefaults release]; 129 BOOL enabled = [defaults boolForKey:WebIconDatabaseEnabledDefaultsKey]; 130 iconDatabase().setEnabled(enabled); 131 if (enabled) 132 [self _startUpIconDatabase]; 133 return self; 120 121 return [super init]; 134 122 } 135 123 136 124 - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size cache:(BOOL)cache 137 125 { 138 ASSERT(size.width); 139 ASSERT(size.height); 140 141 if (!URL || ![self isEnabled]) 142 return [self defaultIconForURL:URL withSize:size]; 143 144 // FIXME - <rdar://problem/4697934> - Move the handling of FileURLs to WebCore and implement in ObjC++ 145 if ([URL _webkit_isFileURL]) 146 return [self _iconForFileURL:URL withSize:size]; 147 148 if (Image* image = iconDatabase().synchronousIconForPageURL(URL, IntSize(size))) 149 if (NSImage *icon = webGetNSImage(image, size)) 150 return icon; 151 return [self defaultIconForURL:URL withSize:size]; 126 return [self defaultIconWithSize:size]; 152 127 } 153 128 154 129 - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size 155 130 { 156 return [self iconForURL:URL withSize:size cache:YES]; 131 return [self defaultIconWithSize:size]; 132 } 133 134 - (NSImage *)defaultIconWithSize:(NSSize)size 135 { 136 static NeverDestroyed<RetainPtr<NSImage>> defaultImage; 137 138 static dispatch_once_t once; 139 dispatch_once(&once, ^ { 140 auto imageData = adoptNS([[NSData alloc] initWithBytes:defaultIconData length:sizeof(defaultIconData)]); 141 defaultImage.get() = adoptNS([[NSImage alloc] initWithData:imageData.get()]); 142 }); 143 144 return defaultImage.get().get(); 145 } 146 147 - (NSImage *)defaultIconForURL:(NSString *)URL withSize:(NSSize)size 148 { 149 return [self defaultIconWithSize:size]; 157 150 } 158 151 159 152 - (NSString *)iconURLForURL:(NSString *)URL 160 153 { 161 if (![self isEnabled]) 162 return nil; 163 164 return iconDatabase().synchronousIconURLForPageURL(URL); 165 } 166 167 - (NSImage *)defaultIconWithSize:(NSSize)size 168 { 169 ASSERT(size.width); 170 ASSERT(size.height); 171 172 Image* image = iconDatabase().defaultIcon(IntSize(size)); 173 return image ? image->snapshotNSImage().autorelease() : nil; 174 } 175 176 - (NSImage *)defaultIconForURL:(NSString *)URL withSize:(NSSize)size 177 { 178 if (_private->delegateImplementsDefaultIconForURL) 179 return [_private->delegate webIconDatabase:self defaultIconForURL:URL withSize:size]; 180 return [self defaultIconWithSize:size]; 154 return nil; 181 155 } 182 156 183 157 - (void)retainIconForURL:(NSString *)URL 184 158 { 185 ASSERT(URL);186 if (![self isEnabled])187 return;188 189 iconDatabase().retainIconForPageURL(URL);190 159 } 191 160 192 161 - (void)releaseIconForURL:(NSString *)pageURL 193 162 { 194 ASSERT(pageURL);195 if (![self isEnabled])196 return;197 198 iconDatabase().releaseIconForPageURL(pageURL);199 163 } 200 164 201 165 + (void)delayDatabaseCleanup 202 166 { 203 IconDatabase::delayDatabaseCleanup();204 167 } 205 168 206 169 + (void)allowDatabaseCleanup 207 170 { 208 IconDatabase::allowDatabaseCleanup();209 171 } 210 172 211 173 - (void)setDelegate:(id)delegate 212 174 { 213 _private->delegate = delegate;214 _private->delegateImplementsDefaultIconForURL = [delegate respondsToSelector:@selector(webIconDatabase:defaultIconForURL:withSize:)];215 175 } 216 176 217 177 - (id)delegate 218 178 { 219 return _private->delegate;179 return nil; 220 180 } 221 181 222 182 @end 223 183 224 225 @implementation WebIconDatabase (WebPendingPublic)226 227 - (BOOL)isEnabled228 {229 return iconDatabase().isEnabled();230 }231 232 - (void)setEnabled:(BOOL)flag233 {234 BOOL currentlyEnabled = [self isEnabled];235 if (currentlyEnabled && !flag) {236 iconDatabase().setEnabled(false);237 [self _shutDownIconDatabase];238 } else if (!currentlyEnabled && flag) {239 iconDatabase().setEnabled(true);240 [self _startUpIconDatabase];241 }242 }243 244 - (void)removeAllIcons245 {246 if (![self isEnabled])247 return;248 249 // Via the IconDatabaseClient interface, removeAllIcons() will send the WebIconDatabaseDidRemoveAllIconsNotification250 iconDatabase().removeAllIcons();251 }252 253 @end254 255 @implementation WebIconDatabase (WebPrivate)256 257 + (void)_checkIntegrityBeforeOpening258 {259 IconDatabase::checkIntegrityBeforeOpening();260 }261 262 @end263 264 @implementation WebIconDatabase (WebInternal)265 266 - (void)_sendNotificationForURL:(NSString *)URL267 {268 ASSERT(URL);269 270 dispatch_async(dispatch_get_main_queue(), ^{271 NSDictionary *userInfo = @{ WebIconNotificationUserInfoURLKey : URL };272 [[NSNotificationCenter defaultCenter] postNotificationName:WebIconDatabaseDidAddIconNotification object:self userInfo:userInfo];273 });274 }275 276 - (void)_sendDidRemoveAllIconsNotification277 {278 dispatch_async(dispatch_get_main_queue(), ^{279 [[NSNotificationCenter defaultCenter] postNotificationName:WebIconDatabaseDidRemoveAllIconsNotification object:self];280 });281 }282 283 - (void)_startUpIconDatabase284 {285 iconDatabase().setClient(defaultClient());286 287 // Figure out the directory we should be using for the icon.db288 NSString *databaseDirectory = [self _databaseDirectory];289 290 // Rename legacy icon database files to the new icon database name291 BOOL isDirectory = NO;292 NSString *legacyDB = [databaseDirectory stringByAppendingPathComponent:@"icon.db"];293 NSFileManager *defaultManager = [NSFileManager defaultManager];294 if ([defaultManager fileExistsAtPath:legacyDB isDirectory:&isDirectory] && !isDirectory) {295 NSString *newDB = [databaseDirectory stringByAppendingPathComponent:IconDatabase::defaultDatabaseFilename()];296 if (![defaultManager fileExistsAtPath:newDB])297 rename([legacyDB fileSystemRepresentation], [newDB fileSystemRepresentation]);298 }299 300 // Set the private browsing pref then open the WebCore icon database301 iconDatabase().setPrivateBrowsingEnabled([[WebPreferences standardPreferences] privateBrowsingEnabled]);302 if (!iconDatabase().open(databaseDirectory, IconDatabase::defaultDatabaseFilename()))303 LOG_ERROR("Unable to open icon database");304 305 // Register for important notifications306 [[NSNotificationCenter defaultCenter] addObserver:self307 selector:@selector(_applicationWillTerminate:)308 name:NSApplicationWillTerminateNotification309 object:NSApp];310 [[NSNotificationCenter defaultCenter] addObserver:self311 selector:@selector(_resetCachedWebPreferences:)312 name:WebPreferencesChangedInternalNotification313 object:nil];314 }315 316 - (void)_shutDownIconDatabase317 {318 // Unregister for important notifications319 [[NSNotificationCenter defaultCenter] removeObserver:self320 name:NSApplicationWillTerminateNotification321 object:NSApp];322 [[NSNotificationCenter defaultCenter] removeObserver:self323 name:WebPreferencesChangedInternalNotification324 object:nil];325 }326 327 - (void)_applicationWillTerminate:(NSNotification *)notification328 {329 iconDatabase().close();330 }331 332 - (NSImage *)_iconForFileURL:(NSString *)file withSize:(NSSize)size333 {334 ASSERT(size.width);335 ASSERT(size.height);336 337 NSWorkspace *workspace = [NSWorkspace sharedWorkspace];338 NSString *path = [[NSURL _web_URLWithDataAsString:file] path];339 NSString *suffix = [path pathExtension];340 NSImage *icon = nil;341 342 if ([suffix _webkit_isCaseInsensitiveEqualToString:@"htm"] || [suffix _webkit_isCaseInsensitiveEqualToString:@"html"]) {343 if (!_private->htmlIcons) {344 icon = [workspace iconForFileType:@"html"];345 _private->htmlIcons = [[self _iconsBySplittingRepresentationsOfIcon:icon] retain];346 }347 icon = [self _iconFromDictionary:_private->htmlIcons forSize:size cache:YES];348 } else {349 if (!path || ![path isAbsolutePath]) {350 // Return the generic icon when there is no path.351 icon = [workspace iconForFileType:NSFileTypeForHFSTypeCode(kGenericDocumentIcon)];352 } else {353 icon = [workspace iconForFile:path];354 }355 [self _scaleIcon:icon toSize:size];356 }357 358 return icon;359 }360 361 - (void)_resetCachedWebPreferences:(NSNotification *)notification362 {363 BOOL privateBrowsingEnabledNow = [[WebPreferences standardPreferences] privateBrowsingEnabled];364 iconDatabase().setPrivateBrowsingEnabled(privateBrowsingEnabledNow);365 }366 367 - (NSImage *)_largestIconFromDictionary:(NSMutableDictionary *)icons368 {369 ASSERT(icons);370 371 NSEnumerator *enumerator = [icons keyEnumerator];372 NSValue *currentSize, *largestSize=nil;373 float largestSizeArea=0;374 375 while ((currentSize = [enumerator nextObject]) != nil) {376 NSSize currentSizeSize = [currentSize sizeValue];377 float currentSizeArea = currentSizeSize.width * currentSizeSize.height;378 if(!largestSizeArea || (currentSizeArea > largestSizeArea)){379 largestSize = currentSize;380 largestSizeArea = currentSizeArea;381 }382 }383 384 return [icons objectForKey:largestSize];385 }386 387 - (NSMutableDictionary *)_iconsBySplittingRepresentationsOfIcon:(NSImage *)icon388 {389 ASSERT(icon);390 391 NSMutableDictionary *icons = [NSMutableDictionary dictionary];392 NSEnumerator *enumerator = [[icon representations] objectEnumerator];393 NSImageRep *rep;394 395 while ((rep = [enumerator nextObject]) != nil) {396 NSSize size = [rep size];397 NSImage *subIcon = [[NSImage alloc] initWithSize:size];398 [subIcon addRepresentation:rep];399 [icons setObject:subIcon forKey:[NSValue valueWithSize:size]];400 [subIcon release];401 }402 403 if([icons count] > 0)404 return icons;405 406 LOG_ERROR("icon has no representations");407 408 return nil;409 }410 411 - (NSImage *)_iconFromDictionary:(NSMutableDictionary *)icons forSize:(NSSize)size cache:(BOOL)cache412 {413 ASSERT(size.width);414 ASSERT(size.height);415 416 NSImage *icon = [icons objectForKey:[NSValue valueWithSize:size]];417 418 if(!icon){419 icon = [[[self _largestIconFromDictionary:icons] copy] autorelease];420 [self _scaleIcon:icon toSize:size];421 422 if(cache){423 [icons setObject:icon forKey:[NSValue valueWithSize:size]];424 }425 }426 427 return icon;428 }429 430 - (void)_scaleIcon:(NSImage *)icon toSize:(NSSize)size431 {432 ASSERT(size.width);433 ASSERT(size.height);434 435 #if !LOG_DISABLED436 double start = CFAbsoluteTimeGetCurrent();437 #endif438 439 #pragma clang diagnostic push440 #pragma clang diagnostic ignored "-Wdeprecated-declarations"441 [icon setScalesWhenResized:YES];442 #pragma clang diagnostic pop443 [icon setSize:size];444 445 #if !LOG_DISABLED446 double duration = CFAbsoluteTimeGetCurrent() - start;447 LOG(Timing, "scaling icon took %f seconds.", duration);448 #endif449 }450 451 - (NSString *)_databaseDirectory452 {453 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];454 455 // Figure out the directory we should be using for the icon.db456 NSString *databaseDirectory = [defaults objectForKey:WebIconDatabaseDirectoryDefaultsKey];457 if (!databaseDirectory) {458 databaseDirectory = WebIconDatabasePath;459 [defaults setObject:databaseDirectory forKey:WebIconDatabaseDirectoryDefaultsKey];460 }461 462 return [[databaseDirectory stringByExpandingTildeInPath] stringByStandardizingPath];463 }464 465 @end466 467 @implementation WebIconDatabasePrivate468 @end469 470 NSImage *webGetNSImage(Image* image, NSSize size)471 {472 ASSERT(size.width);473 ASSERT(size.height);474 475 // FIXME: We're doing the resize here for now because WebCore::Image doesn't yet support resizing/multiple representations476 // This makes it so there's effectively only one size of a particular icon in the system at a time. We should move this477 // to WebCore::Image at some point.478 if (!image)479 return nil;480 NSImage* nsImage = image->nsImage();481 if (!nsImage)482 return nil;483 if (!NSEqualSizes([nsImage size], size)) {484 #pragma clang diagnostic push485 #pragma clang diagnostic ignored "-Wdeprecated-declarations"486 [nsImage setScalesWhenResized:YES];487 #pragma clang diagnostic pop488 [nsImage setSize:size];489 }490 return nsImage;491 }492 493 184 #endif // !PLATFORM(IOS) -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
r219099 r219695 52 52 #import "WebHistoryInternal.h" 53 53 #import "WebHistoryItemInternal.h" 54 #import "WebIconDatabaseInternal.h"55 54 #import "WebKitErrorsPrivate.h" 56 55 #import "WebKitLogging.h" … … 2315 2314 } 2316 2315 2316 #if !PLATFORM(IOS) 2317 static NSImage *webGetNSImage(Image* image, NSSize size) 2318 { 2319 ASSERT(size.width); 2320 ASSERT(size.height); 2321 2322 // FIXME: We're doing the resize here for now because WebCore::Image doesn't yet support resizing/multiple representations 2323 // This makes it so there's effectively only one size of a particular icon in the system at a time. We should move this 2324 // to WebCore::Image at some point. 2325 if (!image) 2326 return nil; 2327 NSImage* nsImage = image->nsImage(); 2328 if (!nsImage) 2329 return nil; 2330 if (!NSEqualSizes([nsImage size], size)) { 2331 #pragma clang diagnostic push 2332 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 2333 [nsImage setScalesWhenResized:YES]; 2334 #pragma clang diagnostic pop 2335 [nsImage setSize:size]; 2336 } 2337 return nsImage; 2338 } 2339 #endif // !PLATFORM(IOS) 2340 2317 2341 void WebFrameLoaderClient::finishedLoadingIcon(uint64_t callbackID, SharedBuffer* iconData) 2318 2342 { -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebIconDatabaseClient.mm
r165676 r219695 29 29 #import "WebIconDatabaseClient.h" 30 30 31 #import "WebIconDatabaseInternal.h"32 31 #import <wtf/text/WTFString.h> 33 32 … … 36 35 void WebIconDatabaseClient::didRemoveAllIcons() 37 36 { 38 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];39 [[WebIconDatabase sharedIconDatabase] _sendDidRemoveAllIconsNotification];40 [pool drain];41 37 } 42 38 43 39 void WebIconDatabaseClient::didImportIconURLForPageURL(const String& pageURL) 44 40 { 45 // This is a quick notification that is likely to fire in a rapidly iterating loop46 // Therefore we let WebCore handle autorelease by draining its pool "from time to time"47 // instead of us doing it every iteration48 [[WebIconDatabase sharedIconDatabase] _sendNotificationForURL:pageURL];49 41 } 50 42 -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r219626 r219695 74 74 #import "WebHTMLViewInternal.h" 75 75 #import "WebHistoryItemInternal.h" 76 #import "WebIconDatabase Internal.h"76 #import "WebIconDatabase.h" 77 77 #import "WebInspector.h" 78 78 #import "WebInspectorClient.h" … … 6225 6225 _private->frameLoadDelegate = delegate; 6226 6226 [self _cacheFrameLoadDelegateImplementations]; 6227 6228 #if ENABLE(ICONDATABASE)6229 // If this delegate wants callbacks for icons, fire up the icon database.6230 if (_private->frameLoadDelegateImplementations.didReceiveIconForFrameFunc)6231 [WebIconDatabase sharedIconDatabase];6232 #endif6233 6227 } 6234 6228 … … 6987 6981 if (auto *icon = _private->_mainFrameIcon.get()) 6988 6982 return icon; 6989 6983 6984 #pragma GCC diagnostic push 6985 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 6990 6986 return [[WebIconDatabase sharedIconDatabase] defaultIconWithSize:WebIconSmallSize]; 6987 #pragma GCC diagnostic pop 6991 6988 } 6992 6989 -
trunk/Tools/ChangeLog
r219689 r219695 1 2017-07-20 Brady Eidson <beidson@apple.com> 2 3 Deprecate WebIconDatabase in WebKitLegacy/mac. 4 https://bugs.webkit.org/show_bug.cgi?id=174607 5 6 Reviewed by Alex Christensen. 7 8 * DumpRenderTree/mac/TestRunnerMac.mm: 9 1 10 2017-07-20 Jonathan Bedard <jbedard@apple.com> 2 11 -
trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm
r219191 r219695 80 80 81 81 #if !PLATFORM(IOS) 82 #import <WebKit/WebIconDatabasePrivate.h>83 82 #import <wtf/SoftLinking.h> 84 83 #endif
Note: See TracChangeset
for help on using the changeset viewer.