[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
darin at apple.com
darin at apple.com
Sun Feb 20 23:49:54 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit c58ff503b7b978cbccdbb42e0e7852dc78c94bb8
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 25 19:03:16 2011 +0000
2011-01-25 Darin Adler <darin at apple.com>
Reviewed by Anders Carlsson.
WebKit is using CSBackupSetItemExcluded incorrectly
https://bugs.webkit.org/show_bug.cgi?id=53095
rdar://problem/8790540
* Misc/WebIconDatabase.mm:
(importToWebCoreFormat): Removed code that was calling CSBackupSetItemExcluded.
It was incorrect, and this responsibility has been moved to WebCore.
2011-01-25 Darin Adler <darin at apple.com>
Reviewed by Anders Carlsson.
WebKit is using CSBackupSetItemExcluded incorrectly
https://bugs.webkit.org/show_bug.cgi?id=53095
rdar://problem/8790540
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::performOpenInitialization): Added code to
exclude the database from backup one time, and record inside the
database that this has been done.
(WebCore::IconDatabase::wasExcludedFromBackup): Added.
(WebCore::IconDatabase::setWasExcludedFromBackup): Added.
* loader/icon/IconDatabase.h: Added new functions above.
* platform/FileSystem.cpp:
(WebCore::canExcludeFromBackup): Added.
(WebCore::excludeFromBackup): Added.
* platform/FileSystem.h: Added canExcludeFromBackup, excludeFromBackup,
and pathAsURL functions. Cleaned up ifdefs and comments a bit and sorted
things alphabetically, particularly platform-specific sections.
* platform/cf/FileSystemCF.cpp:
(WebCore::pathAsURL): Added.
* platform/mac/FileSystemMac.mm:
(WebCore::canExcludeFromBackup): Added.
(WebCore::excludeFromBackup): Added.
* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::advanceCurrentStream): Changed to call pathAsURL.
* platform/network/mac/FormDataStreamMac.mm:
(WebCore::advanceCurrentStream): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 71adaab..2e4024c 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,39 @@
+2011-01-25 Darin Adler <darin at apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ WebKit is using CSBackupSetItemExcluded incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=53095
+ rdar://problem/8790540
+
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::performOpenInitialization): Added code to
+ exclude the database from backup one time, and record inside the
+ database that this has been done.
+ (WebCore::IconDatabase::wasExcludedFromBackup): Added.
+ (WebCore::IconDatabase::setWasExcludedFromBackup): Added.
+ * loader/icon/IconDatabase.h: Added new functions above.
+
+ * platform/FileSystem.cpp:
+ (WebCore::canExcludeFromBackup): Added.
+ (WebCore::excludeFromBackup): Added.
+
+ * platform/FileSystem.h: Added canExcludeFromBackup, excludeFromBackup,
+ and pathAsURL functions. Cleaned up ifdefs and comments a bit and sorted
+ things alphabetically, particularly platform-specific sections.
+
+ * platform/cf/FileSystemCF.cpp:
+ (WebCore::pathAsURL): Added.
+
+ * platform/mac/FileSystemMac.mm:
+ (WebCore::canExcludeFromBackup): Added.
+ (WebCore::excludeFromBackup): Added.
+
+ * platform/network/cf/FormDataStreamCFNet.cpp:
+ (WebCore::advanceCurrentStream): Changed to call pathAsURL.
+ * platform/network/mac/FormDataStreamMac.mm:
+ (WebCore::advanceCurrentStream): Ditto.
+
2011-01-25 Helder Correia <helder at sencha.com>
Reviewed by Dirk Schulze.
diff --git a/Source/WebCore/loader/icon/IconDatabase.cpp b/Source/WebCore/loader/icon/IconDatabase.cpp
index d3ef0c1..c00d395 100644
--- a/Source/WebCore/loader/icon/IconDatabase.cpp
+++ b/Source/WebCore/loader/icon/IconDatabase.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2007 Justin Haygood (jhaygood at reaktix.com)
*
* Redistribution and use in source and binary forms, with or without
@@ -1051,7 +1051,6 @@ static int databaseVersionNumber(SQLiteDatabase& db)
static bool isValidDatabase(SQLiteDatabase& db)
{
-
// These four tables should always exist in a valid db
if (!db.tableExists("IconInfo") || !db.tableExists("IconData") || !db.tableExists("PageURL") || !db.tableExists("IconDatabaseInfo"))
return false;
@@ -1155,6 +1154,13 @@ void IconDatabase::performOpenInitialization()
// Reduce sqlite RAM cache size from default 2000 pages (~1.5kB per page). 3MB of cache for icon database is overkill
if (!SQLiteStatement(m_syncDB, "PRAGMA cache_size = 200;").executeCommand())
LOG_ERROR("SQLite database could not set cache_size");
+
+ // Tell backup software (i.e., Time Machine) to never back up the icon database, because
+ // it's a large file that changes frequently, thus using a lot of backup disk space, and
+ // it's unlikely that many users would be upset about it not being backed up. We could
+ // make this configurable on a per-client basis some day if some clients don't want this.
+ if (canExcludeFromBackup() && !wasExcludedFromBackup() && excludeFromBackup(m_completeDatabasePath))
+ setWasExcludedFromBackup();
}
bool IconDatabase::checkIntegrity()
@@ -2086,6 +2092,20 @@ void IconDatabase::writeIconSnapshotToSQLDatabase(const IconSnapshot& snapshot)
}
}
+bool IconDatabase::wasExcludedFromBackup()
+{
+ ASSERT_ICON_SYNC_THREAD();
+
+ return SQLiteStatement(m_syncDB, "SELECT value FROM IconDatabaseInfo WHERE key = 'ExcludedFromBackup';").getColumnInt(0);
+}
+
+void IconDatabase::setWasExcludedFromBackup()
+{
+ ASSERT_ICON_SYNC_THREAD();
+
+ SQLiteStatement(m_syncDB, "INSERT INTO IconDatabaseInfo (key, value) VALUES ('ExcludedFromBackup', 1)").executeCommand();
+}
+
} // namespace WebCore
#endif // ENABLE(ICONDATABASE)
diff --git a/Source/WebCore/loader/icon/IconDatabase.h b/Source/WebCore/loader/icon/IconDatabase.h
index e08dcd4..5dc8288 100644
--- a/Source/WebCore/loader/icon/IconDatabase.h
+++ b/Source/WebCore/loader/icon/IconDatabase.h
@@ -199,6 +199,9 @@ private:
bool imported();
void setImported(bool);
+ bool wasExcludedFromBackup();
+ void setWasExcludedFromBackup();
+
bool m_initialPruningComplete;
void setIconURLForPageURLInSQLDatabase(const String&, const String&);
diff --git a/Source/WebCore/platform/FileSystem.cpp b/Source/WebCore/platform/FileSystem.cpp
index 511f8aa..0f69b7f 100644
--- a/Source/WebCore/platform/FileSystem.cpp
+++ b/Source/WebCore/platform/FileSystem.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -101,4 +101,18 @@ String encodeForFileName(const String& inputStr)
return String(buffer.data(), p - buffer.data());
}
+#if !PLATFORM(MAC)
+
+bool canExcludeFromBackup()
+{
+ return false;
+}
+
+bool excludeFromBackup(const String&)
+{
+ return false;
+}
+
+#endif
+
} // namespace WebCore
diff --git a/Source/WebCore/platform/FileSystem.h b/Source/WebCore/platform/FileSystem.h
index 4f088e1..3bc1dd9 100644
--- a/Source/WebCore/platform/FileSystem.h
+++ b/Source/WebCore/platform/FileSystem.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Collabora, Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,15 @@
#ifndef FileSystem_h
#define FileSystem_h
+#include "PlatformString.h"
+#include <time.h>
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(CF)
+#include <wtf/RetainPtr.h>
+#endif
+
#if PLATFORM(QT)
#include <QFile>
#include <QLibrary>
@@ -39,15 +48,9 @@
#endif
#if PLATFORM(CF) || (PLATFORM(QT) && defined(Q_WS_MAC))
-#include <CoreFoundation/CFBundle.h>
-#endif
-
-#include "PlatformString.h"
-#include <time.h>
-#include <wtf/Forward.h>
-#include <wtf/Vector.h>
-
+typedef struct __CFBundle* CFBundleRef;
typedef const struct __CFData* CFDataRef;
+#endif
#if OS(WINDOWS)
// These are to avoid including <winbase.h> in a header for Chromium
@@ -122,8 +125,6 @@ const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1
#elif PLATFORM(BREWMP)
typedef IFile* PlatformFileHandle;
const PlatformFileHandle invalidPlatformFileHandle = 0;
-typedef void* PlatformModule;
-typedef unsigned PlatformModuleVersion;
#elif PLATFORM(GTK)
typedef GFileIOStream* PlatformFileHandle;
const PlatformFileHandle invalidPlatformFileHandle = 0;
@@ -161,6 +162,9 @@ String homeDirectoryPath();
String pathGetFileName(const String&);
String directoryName(const String&);
+bool canExcludeFromBackup(); // Returns true if any file can ever be excluded from backup.
+bool excludeFromBackup(const String&); // Returns true if successful.
+
Vector<String> listDirectory(const String& path, const String& filter = String());
CString fileSystemRepresentation(const String&);
@@ -179,17 +183,18 @@ int writeToFile(PlatformFileHandle, const char* data, int length);
// Returns number of bytes actually written if successful, -1 otherwise.
int readFromFile(PlatformFileHandle, char* data, int length);
-// Methods for dealing with loadable modules
+// Functions for working with loadable modules.
bool unloadModule(PlatformModule);
// Encode a string for use within a file name.
String encodeForFileName(const String&);
-#if PLATFORM(WIN)
-String localUserSpecificStorageDirectory();
-String roamingUserSpecificStorageDirectory();
+#if PLATFORM(CF)
+RetainPtr<CFURLRef> pathAsURL(const String&);
+#endif
-bool safeCreateFile(const String&, CFDataRef);
+#if PLATFORM(CHROMIUM)
+String pathGetDisplayFileName(const String&);
#endif
#if PLATFORM(GTK)
@@ -198,8 +203,10 @@ String filenameForDisplay(const String&);
CString applicationDirectoryPath();
#endif
-#if PLATFORM(CHROMIUM)
-String pathGetDisplayFileName(const String&);
+#if PLATFORM(WIN)
+String localUserSpecificStorageDirectory();
+String roamingUserSpecificStorageDirectory();
+bool safeCreateFile(const String&, CFDataRef);
#endif
} // namespace WebCore
diff --git a/Source/WebCore/platform/cf/FileSystemCF.cpp b/Source/WebCore/platform/cf/FileSystemCF.cpp
index e3a144c..a4b422b 100644
--- a/Source/WebCore/platform/cf/FileSystemCF.cpp
+++ b/Source/WebCore/platform/cf/FileSystemCF.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,12 +25,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#import "config.h"
#import "FileSystem.h"
#import "PlatformString.h"
-#import <wtf/text/CString.h>
#import <wtf/RetainPtr.h>
+#import <wtf/text/CString.h>
namespace WebCore {
@@ -54,4 +55,16 @@ CString fileSystemRepresentation(const String& path)
return string;
}
+RetainPtr<CFURLRef> pathAsURL(const String& path)
+{
+ CFURLPathStyle pathStyle;
+#if PLATFORM(WIN)
+ pathStyle = kCFURLWindowsPathStyle;
+#else
+ pathStyle = kCFURLPOSIXPathStyle;
+#endif
+ return RetainPtr<CFURLRef>(AdoptCF, CFURLCreateWithFileSystemPath(0,
+ RetainPtr<CFStringRef>(AdoptCF, path.createCFString()).get(), pathStyle, FALSE));
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/platform/mac/FileSystemMac.mm b/Source/WebCore/platform/mac/FileSystemMac.mm
index 0df3c89..bbeb76a 100644
--- a/Source/WebCore/platform/mac/FileSystemMac.mm
+++ b/Source/WebCore/platform/mac/FileSystemMac.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,10 +25,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#import "config.h"
#import "FileSystem.h"
#import "PlatformString.h"
+#import <wtf/RetainPtr.h>
#import <wtf/text/CString.h>
namespace WebCore {
@@ -62,4 +64,25 @@ CString openTemporaryFile(const char* prefix, PlatformFileHandle& platformFileHa
return CString(temporaryFilePath.data());
}
+bool canExcludeFromBackup()
+{
+#ifdef BUILDING_ON_TIGER
+ return false;
+#else
+ return true;
+#endif
+}
+
+bool excludeFromBackup(const String& path)
+{
+#ifdef BUILDING_ON_TIGER
+ UNUSED_PARAM(path);
+ return false;
+#else
+ // It is critical to pass FALSE for excludeByPath because excluding by path requires root privileges.
+ CSBackupSetItemExcluded(pathAsURL(path).get(), TRUE, FALSE);
+ return true;
+#endif
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp b/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
index eb0ec3a..8bc8f08 100644
--- a/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
@@ -145,17 +145,8 @@ static void advanceCurrentStream(FormStreamFields *form)
char* data = nextInput.m_data.releaseBuffer();
form->currentStream = CFReadStreamCreateWithBytesNoCopy(0, reinterpret_cast<const UInt8*>(data), size, kCFAllocatorNull);
form->currentData = data;
- } else {
- CFStringRef filename = nextInput.m_filename.createCFString();
-#if PLATFORM(WIN)
- CFURLRef fileURL = CFURLCreateWithFileSystemPath(0, filename, kCFURLWindowsPathStyle, FALSE);
-#else
- CFURLRef fileURL = CFURLCreateWithFileSystemPath(0, filename, kCFURLPOSIXPathStyle, FALSE);
-#endif
- CFRelease(filename);
- form->currentStream = CFReadStreamCreateWithFile(0, fileURL);
- CFRelease(fileURL);
- }
+ } else
+ form->currentStream = CFReadStreamCreateWithFile(0, pathAsURL(nextInput.m_filename).get());
form->remainingElements.removeLast();
// Set up the callback.
diff --git a/Source/WebCore/platform/network/mac/FormDataStreamMac.mm b/Source/WebCore/platform/network/mac/FormDataStreamMac.mm
index 03f4579..eb6f601 100644
--- a/Source/WebCore/platform/network/mac/FormDataStreamMac.mm
+++ b/Source/WebCore/platform/network/mac/FormDataStreamMac.mm
@@ -185,9 +185,7 @@ static bool advanceCurrentStream(FormStreamFields* form)
}
#endif
const String& path = nextInput.m_shouldGenerateFile ? nextInput.m_generatedFilename : nextInput.m_filename;
- RetainPtr<CFStringRef> filename(AdoptCF, path.createCFString());
- RetainPtr<CFURLRef> fileURL(AdoptCF, CFURLCreateWithFileSystemPath(0, filename.get(), kCFURLPOSIXPathStyle, FALSE));
- form->currentStream = CFReadStreamCreateWithFile(0, fileURL.get());
+ form->currentStream = CFReadStreamCreateWithFile(0, pathAsURL(path).get());
if (!form->currentStream) {
// The file must have been removed or become unreadable.
return false;
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index cdc1b0f..1f4e3c4 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-25 Darin Adler <darin at apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ WebKit is using CSBackupSetItemExcluded incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=53095
+ rdar://problem/8790540
+
+ * Misc/WebIconDatabase.mm:
+ (importToWebCoreFormat): Removed code that was calling CSBackupSetItemExcluded.
+ It was incorrect, and this responsibility has been moved to WebCore.
+
2011-01-24 Chris Marrin <cmarrin at apple.com>
Reviewed by Eric Seidel.
diff --git a/Source/WebKit/mac/Misc/WebIconDatabase.mm b/Source/WebKit/mac/Misc/WebIconDatabase.mm
index 7d0a350..14ef037 100644
--- a/Source/WebKit/mac/Misc/WebIconDatabase.mm
+++ b/Source/WebKit/mac/Misc/WebIconDatabase.mm
@@ -590,24 +590,6 @@ bool importToWebCoreFormat()
[ThreadEnabler enableThreading];
ASSERT([NSThread isMultiThreaded]);
-#ifndef BUILDING_ON_TIGER
- // Tell backup software (i.e., Time Machine) to never back up the icon database, because
- // it's a large file that changes frequently, thus using a lot of backup disk space, and
- // it's unlikely that many users would be upset about it not being backed up. We do this
- // here because this code is only executed once for each icon database instance. We could
- // make this configurable on a per-client basis someday if that seemed useful.
- // See <rdar://problem/5320208>.
- // FIXME: This has nothing to do with importing from the old to the new database format and should be moved elsewhere,
- // especially because we might eventually delete all of this legacy importing code and we shouldn't delete this.
- CFStringRef databasePath = iconDatabase()->databasePath().createCFString();
- if (databasePath) {
- CFURLRef databasePathURL = CFURLCreateWithFileSystemPath(0, databasePath, kCFURLPOSIXPathStyle, FALSE);
- CFRelease(databasePath);
- CSBackupSetItemExcluded(databasePathURL, true, true);
- CFRelease(databasePathURL);
- }
-#endif
-
// Get the directory the old icon database *should* be in
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *databaseDirectory = [defaults objectForKey:WebIconDatabaseImportDirectoryDefaultsKey];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list