Commit 8eacd082 authored by staikos's avatar staikos
Browse files

Patch from Adam Treat to make the SQLite icon database optional.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 19fba7c1
2007-06-26 Adam Treat <adam@staikos.net>
Reviewed by Adam Roben.
Make the SQLite icon database optional.
* wtf/Platform.h:
2007-06-15 George Staikos <staikos@kde.org>
 
More missing files for Qt.
......
......@@ -201,4 +201,6 @@
#define USE_SYSTEM_MALLOC 1
#endif
#define WTF_USE_ICONDATABASE 1
#endif /* WTF_Platform_h */
2007-06-26 Adam Treat <adam@staikos.net>
Reviewed by Adam Roben.
Make the SQLite icon database optional.
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::isOpen):
(WebCore::IconDatabase::isPrivateBrowsingEnabled):
(WebCore::IconDatabase::enabled):
* loader/icon/IconDatabase.h:
2007-06-25 Sam Weinig <sam@webkit.org>
 
Reviewed by Adam Roben.
......@@ -200,6 +200,11 @@ bool IconDatabase::open(const String& databasePath)
return isOpen();
}
bool IconDatabase::isOpen()
{
return m_mainDB.isOpen() && m_privateBrowsingDB.isOpen();
}
void IconDatabase::close()
{
// This will close all the SQL statements and transactions we have open,
......@@ -366,6 +371,11 @@ void IconDatabase::setPrivateBrowsingEnabled(bool flag)
}
}
bool IconDatabase::isPrivateBrowsingEnabled() const
{
return m_privateBrowsingEnabled;
}
Image* IconDatabase::iconForPageURL(const String& pageURL, const IntSize& size, bool cache)
{
if (!isOpen())
......@@ -918,6 +928,11 @@ void IconDatabase::setEnabled(bool enabled)
m_isEnabled = enabled;
}
bool IconDatabase::enabled() const
{
return m_isEnabled;
}
bool IconDatabase::imported()
{
if (!m_isImportedSet) {
......
......@@ -26,7 +26,10 @@
#ifndef IconDatabase_h
#define IconDatabase_h
#if USE(ICONDATABASE)
#include "SQLDatabase.h"
#endif
#include "StringHash.h"
#include "Timer.h"
#include <wtf/Noncopyable.h>
......@@ -39,12 +42,15 @@ class Image;
class IntSize;
class IconDataCache;
class SharedBuffer;
#if USE(ICONDATABASE)
class SQLTransaction;
#endif
class IconDatabase : Noncopyable {
public:
bool open(const String& path);
bool isOpen() { return m_mainDB.isOpen() && m_privateBrowsingDB.isOpen(); }
bool isOpen();
void close();
void removeAllIcons();
......@@ -60,7 +66,7 @@ public:
void releaseIconForPageURL(const String&);
void setPrivateBrowsingEnabled(bool flag);
bool isPrivateBrowsingEnabled() const { return m_privateBrowsingEnabled; }
bool isPrivateBrowsingEnabled() const;
bool hasEntryForIconURL(const String&);
......@@ -73,7 +79,7 @@ public:
bool setIconURLForPageURL(const String& iconURL, const String& pageURL);
void setEnabled(bool enabled);
bool enabled() const { return m_isEnabled; }
bool enabled() const;
bool imported();
void setImported(bool);
......@@ -85,6 +91,7 @@ private:
~IconDatabase();
friend IconDatabase* iconDatabase();
#if USE(ICONDATABASE)
// This tries to get the iconID for the IconURL and, if it doesn't exist and createIfNecessary is true,
// it will create the entry and return the new iconID
int64_t establishIconIDForIconURL(SQLDatabase&, const String&, bool createIfNecessary = true);
......@@ -209,6 +216,7 @@ private:
HashSet<String> m_pageURLsPendingDeletion;
HashSet<String> m_iconURLsPendingDeletion;
#endif
};
// Function to obtain the global icon database.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment