diff options
Diffstat (limited to 'Source/WebCore/loader/icon')
-rw-r--r-- | Source/WebCore/loader/icon/IconDatabase.cpp | 24 | ||||
-rw-r--r-- | Source/WebCore/loader/icon/IconDatabase.h | 3 | ||||
-rw-r--r-- | Source/WebCore/loader/icon/IconLoader.cpp | 5 |
3 files changed, 29 insertions, 3 deletions
diff --git a/Source/WebCore/loader/icon/IconDatabase.cpp b/Source/WebCore/loader/icon/IconDatabase.cpp index 6040037..95746ae 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@reaktix.com) * * Redistribution and use in source and binary forms, with or without @@ -1056,7 +1056,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; @@ -1160,6 +1159,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() @@ -2091,6 +2097,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/loader/icon/IconLoader.cpp b/Source/WebCore/loader/icon/IconLoader.cpp index 24562d0..bb738e8 100644 --- a/Source/WebCore/loader/icon/IconLoader.cpp +++ b/Source/WebCore/loader/icon/IconLoader.cpp @@ -69,7 +69,10 @@ void IconLoader::startLoading() // SubresourceLoader::create returns. m_loadIsInProgress = true; - RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_frame, this, m_frame->loader()->iconURL()); + ResourceRequest resourceRequest(m_frame->loader()->iconURL()); + resourceRequest.setPriority(ResourceLoadPriorityLow); + + RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_frame, this, resourceRequest); if (!loader) LOG_ERROR("Failed to start load for icon at url %s", m_frame->loader()->iconURL().string().ascii().data()); |