Changeset 76614 in webkit
- Timestamp:
- Jan 25, 2011 11:03:16 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76612 r76614 1 2011-01-25 Darin Adler <darin@apple.com> 2 3 Reviewed by Anders Carlsson. 4 5 WebKit is using CSBackupSetItemExcluded incorrectly 6 https://bugs.webkit.org/show_bug.cgi?id=53095 7 rdar://problem/8790540 8 9 * loader/icon/IconDatabase.cpp: 10 (WebCore::IconDatabase::performOpenInitialization): Added code to 11 exclude the database from backup one time, and record inside the 12 database that this has been done. 13 (WebCore::IconDatabase::wasExcludedFromBackup): Added. 14 (WebCore::IconDatabase::setWasExcludedFromBackup): Added. 15 * loader/icon/IconDatabase.h: Added new functions above. 16 17 * platform/FileSystem.cpp: 18 (WebCore::canExcludeFromBackup): Added. 19 (WebCore::excludeFromBackup): Added. 20 21 * platform/FileSystem.h: Added canExcludeFromBackup, excludeFromBackup, 22 and pathAsURL functions. Cleaned up ifdefs and comments a bit and sorted 23 things alphabetically, particularly platform-specific sections. 24 25 * platform/cf/FileSystemCF.cpp: 26 (WebCore::pathAsURL): Added. 27 28 * platform/mac/FileSystemMac.mm: 29 (WebCore::canExcludeFromBackup): Added. 30 (WebCore::excludeFromBackup): Added. 31 32 * platform/network/cf/FormDataStreamCFNet.cpp: 33 (WebCore::advanceCurrentStream): Changed to call pathAsURL. 34 * platform/network/mac/FormDataStreamMac.mm: 35 (WebCore::advanceCurrentStream): Ditto. 36 1 37 2011-01-25 Helder Correia <helder@sencha.com> 2 38 -
trunk/Source/WebCore/loader/icon/IconDatabase.cpp
r67619 r76614 1 1 /* 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 4 4 * … … 1052 1052 static bool isValidDatabase(SQLiteDatabase& db) 1053 1053 { 1054 1055 1054 // These four tables should always exist in a valid db 1056 1055 if (!db.tableExists("IconInfo") || !db.tableExists("IconData") || !db.tableExists("PageURL") || !db.tableExists("IconDatabaseInfo")) … … 1156 1155 if (!SQLiteStatement(m_syncDB, "PRAGMA cache_size = 200;").executeCommand()) 1157 1156 LOG_ERROR("SQLite database could not set cache_size"); 1157 1158 // Tell backup software (i.e., Time Machine) to never back up the icon database, because 1159 // it's a large file that changes frequently, thus using a lot of backup disk space, and 1160 // it's unlikely that many users would be upset about it not being backed up. We could 1161 // make this configurable on a per-client basis some day if some clients don't want this. 1162 if (canExcludeFromBackup() && !wasExcludedFromBackup() && excludeFromBackup(m_completeDatabasePath)) 1163 setWasExcludedFromBackup(); 1158 1164 } 1159 1165 … … 2087 2093 } 2088 2094 2095 bool IconDatabase::wasExcludedFromBackup() 2096 { 2097 ASSERT_ICON_SYNC_THREAD(); 2098 2099 return SQLiteStatement(m_syncDB, "SELECT value FROM IconDatabaseInfo WHERE key = 'ExcludedFromBackup';").getColumnInt(0); 2100 } 2101 2102 void IconDatabase::setWasExcludedFromBackup() 2103 { 2104 ASSERT_ICON_SYNC_THREAD(); 2105 2106 SQLiteStatement(m_syncDB, "INSERT INTO IconDatabaseInfo (key, value) VALUES ('ExcludedFromBackup', 1)").executeCommand(); 2107 } 2108 2089 2109 } // namespace WebCore 2090 2110 -
trunk/Source/WebCore/loader/icon/IconDatabase.h
r76248 r76614 200 200 void setImported(bool); 201 201 202 bool wasExcludedFromBackup(); 203 void setWasExcludedFromBackup(); 204 202 205 bool m_initialPruningComplete; 203 206 -
trunk/Source/WebCore/platform/FileSystem.cpp
r65509 r76614 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 102 102 } 103 103 104 #if !PLATFORM(MAC) 105 106 bool canExcludeFromBackup() 107 { 108 return false; 109 } 110 111 bool excludeFromBackup(const String&) 112 { 113 return false; 114 } 115 116 #endif 117 104 118 } // namespace WebCore -
trunk/Source/WebCore/platform/FileSystem.h
r75347 r76614 1 1 /* 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. 4 4 * … … 31 31 #define FileSystem_h 32 32 33 #include "PlatformString.h" 34 #include <time.h> 35 #include <wtf/Forward.h> 36 #include <wtf/Vector.h> 37 38 #if PLATFORM(CF) 39 #include <wtf/RetainPtr.h> 40 #endif 41 33 42 #if PLATFORM(QT) 34 43 #include <QFile> … … 40 49 41 50 #if PLATFORM(CF) || (PLATFORM(QT) && defined(Q_WS_MAC)) 42 #include <CoreFoundation/CFBundle.h> 43 #endif 44 45 #include "PlatformString.h" 46 #include <time.h> 47 #include <wtf/Forward.h> 48 #include <wtf/Vector.h> 49 51 typedef struct __CFBundle* CFBundleRef; 50 52 typedef const struct __CFData* CFDataRef; 53 #endif 51 54 52 55 #if OS(WINDOWS) … … 123 126 typedef IFile* PlatformFileHandle; 124 127 const PlatformFileHandle invalidPlatformFileHandle = 0; 125 typedef void* PlatformModule;126 typedef unsigned PlatformModuleVersion;127 128 #elif PLATFORM(GTK) 128 129 typedef GFileIOStream* PlatformFileHandle; … … 162 163 String directoryName(const String&); 163 164 165 bool canExcludeFromBackup(); // Returns true if any file can ever be excluded from backup. 166 bool excludeFromBackup(const String&); // Returns true if successful. 167 164 168 Vector<String> listDirectory(const String& path, const String& filter = String()); 165 169 … … 180 184 int readFromFile(PlatformFileHandle, char* data, int length); 181 185 182 // Methods for dealing with loadable modules186 // Functions for working with loadable modules. 183 187 bool unloadModule(PlatformModule); 184 188 … … 186 190 String encodeForFileName(const String&); 187 191 188 #if PLATFORM(WIN) 189 String localUserSpecificStorageDirectory(); 190 String roamingUserSpecificStorageDirectory(); 191 192 bool safeCreateFile(const String&, CFDataRef); 192 #if PLATFORM(CF) 193 RetainPtr<CFURLRef> pathAsURL(const String&); 194 #endif 195 196 #if PLATFORM(CHROMIUM) 197 String pathGetDisplayFileName(const String&); 193 198 #endif 194 199 … … 199 204 #endif 200 205 201 #if PLATFORM(CHROMIUM) 202 String pathGetDisplayFileName(const String&); 206 #if PLATFORM(WIN) 207 String localUserSpecificStorageDirectory(); 208 String roamingUserSpecificStorageDirectory(); 209 bool safeCreateFile(const String&, CFDataRef); 203 210 #endif 204 211 -
trunk/Source/WebCore/platform/cf/FileSystemCF.cpp
r56825 r76614 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 #import "config.h" 29 30 #import "FileSystem.h" 30 31 31 32 #import "PlatformString.h" 33 #import <wtf/RetainPtr.h> 32 34 #import <wtf/text/CString.h> 33 #import <wtf/RetainPtr.h>34 35 35 36 namespace WebCore { … … 55 56 } 56 57 58 RetainPtr<CFURLRef> pathAsURL(const String& path) 59 { 60 CFURLPathStyle pathStyle; 61 #if PLATFORM(WIN) 62 pathStyle = kCFURLWindowsPathStyle; 63 #else 64 pathStyle = kCFURLPOSIXPathStyle; 65 #endif 66 return RetainPtr<CFURLRef>(AdoptCF, CFURLCreateWithFileSystemPath(0, 67 RetainPtr<CFStringRef>(AdoptCF, path.createCFString()).get(), pathStyle, FALSE)); 68 } 69 57 70 } // namespace WebCore -
trunk/Source/WebCore/platform/mac/FileSystemMac.mm
r63704 r76614 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 #import "config.h" 29 30 #import "FileSystem.h" 30 31 31 32 #import "PlatformString.h" 33 #import <wtf/RetainPtr.h> 32 34 #import <wtf/text/CString.h> 33 35 … … 63 65 } 64 66 67 bool canExcludeFromBackup() 68 { 69 #ifdef BUILDING_ON_TIGER 70 return false; 71 #else 72 return true; 73 #endif 74 } 75 76 bool excludeFromBackup(const String& path) 77 { 78 #ifdef BUILDING_ON_TIGER 79 UNUSED_PARAM(path); 80 return false; 81 #else 82 // It is critical to pass FALSE for excludeByPath because excluding by path requires root privileges. 83 CSBackupSetItemExcluded(pathAsURL(path).get(), TRUE, FALSE); 84 return true; 85 #endif 86 } 87 65 88 } // namespace WebCore -
trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
r74943 r76614 146 146 form->currentStream = CFReadStreamCreateWithBytesNoCopy(0, reinterpret_cast<const UInt8*>(data), size, kCFAllocatorNull); 147 147 form->currentData = data; 148 } else { 149 CFStringRef filename = nextInput.m_filename.createCFString(); 150 #if PLATFORM(WIN) 151 CFURLRef fileURL = CFURLCreateWithFileSystemPath(0, filename, kCFURLWindowsPathStyle, FALSE); 152 #else 153 CFURLRef fileURL = CFURLCreateWithFileSystemPath(0, filename, kCFURLPOSIXPathStyle, FALSE); 154 #endif 155 CFRelease(filename); 156 form->currentStream = CFReadStreamCreateWithFile(0, fileURL); 157 CFRelease(fileURL); 158 } 148 } else 149 form->currentStream = CFReadStreamCreateWithFile(0, pathAsURL(nextInput.m_filename).get()); 159 150 form->remainingElements.removeLast(); 160 151 -
trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.mm
r74952 r76614 186 186 #endif 187 187 const String& path = nextInput.m_shouldGenerateFile ? nextInput.m_generatedFilename : nextInput.m_filename; 188 RetainPtr<CFStringRef> filename(AdoptCF, path.createCFString()); 189 RetainPtr<CFURLRef> fileURL(AdoptCF, CFURLCreateWithFileSystemPath(0, filename.get(), kCFURLPOSIXPathStyle, FALSE)); 190 form->currentStream = CFReadStreamCreateWithFile(0, fileURL.get()); 188 form->currentStream = CFReadStreamCreateWithFile(0, pathAsURL(path).get()); 191 189 if (!form->currentStream) { 192 190 // The file must have been removed or become unreadable. -
trunk/Source/WebKit/mac/ChangeLog
r76600 r76614 1 2011-01-25 Darin Adler <darin@apple.com> 2 3 Reviewed by Anders Carlsson. 4 5 WebKit is using CSBackupSetItemExcluded incorrectly 6 https://bugs.webkit.org/show_bug.cgi?id=53095 7 rdar://problem/8790540 8 9 * Misc/WebIconDatabase.mm: 10 (importToWebCoreFormat): Removed code that was calling CSBackupSetItemExcluded. 11 It was incorrect, and this responsibility has been moved to WebCore. 12 1 13 2011-01-24 Chris Marrin <cmarrin@apple.com> 2 14 -
trunk/Source/WebKit/mac/Misc/WebIconDatabase.mm
r63632 r76614 591 591 ASSERT([NSThread isMultiThreaded]); 592 592 593 #ifndef BUILDING_ON_TIGER594 // Tell backup software (i.e., Time Machine) to never back up the icon database, because595 // it's a large file that changes frequently, thus using a lot of backup disk space, and596 // it's unlikely that many users would be upset about it not being backed up. We do this597 // here because this code is only executed once for each icon database instance. We could598 // make this configurable on a per-client basis someday if that seemed useful.599 // See <rdar://problem/5320208>.600 // FIXME: This has nothing to do with importing from the old to the new database format and should be moved elsewhere,601 // especially because we might eventually delete all of this legacy importing code and we shouldn't delete this.602 CFStringRef databasePath = iconDatabase()->databasePath().createCFString();603 if (databasePath) {604 CFURLRef databasePathURL = CFURLCreateWithFileSystemPath(0, databasePath, kCFURLPOSIXPathStyle, FALSE);605 CFRelease(databasePath);606 CSBackupSetItemExcluded(databasePathURL, true, true);607 CFRelease(databasePathURL);608 }609 #endif610 611 593 // Get the directory the old icon database *should* be in 612 594 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
Note: See TracChangeset
for help on using the changeset viewer.