summaryrefslogtreecommitdiffstats
path: root/WebCore/storage
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-08-19 17:55:56 +0100
committerIain Merrick <husky@google.com>2010-08-23 11:05:40 +0100
commitf486d19d62f1bc33246748b14b14a9dfa617b57f (patch)
tree195485454c93125455a30e553a73981c3816144d /WebCore/storage
parent6ba0b43722d16bc295606bec39f396f596e4fef1 (diff)
downloadexternal_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.zip
external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.gz
external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.bz2
Merge WebKit at r65615 : Initial merge by git.
Change-Id: Ifbf384f4531e3b58475a662e38195c2d9152ae79
Diffstat (limited to 'WebCore/storage')
-rw-r--r--WebCore/storage/AbstractDatabase.cpp2
-rw-r--r--WebCore/storage/DOMFileSystem.cpp6
-rw-r--r--WebCore/storage/DOMFileSystem.h4
-rw-r--r--WebCore/storage/DOMFileSystem.idl2
-rw-r--r--WebCore/storage/Database.cpp15
-rw-r--r--WebCore/storage/DatabaseAuthorizer.h2
-rw-r--r--WebCore/storage/DatabaseTask.cpp8
-rw-r--r--WebCore/storage/DatabaseTask.h18
-rw-r--r--WebCore/storage/DatabaseThread.cpp12
-rw-r--r--WebCore/storage/DatabaseThread.h2
-rw-r--r--WebCore/storage/DatabaseTracker.cpp4
-rw-r--r--WebCore/storage/DatabaseTracker.h2
-rw-r--r--WebCore/storage/DirectoryEntry.cpp66
-rw-r--r--WebCore/storage/DirectoryEntry.h68
-rw-r--r--WebCore/storage/DirectoryEntry.idl41
-rw-r--r--WebCore/storage/DirectoryReader.cpp56
-rw-r--r--WebCore/storage/DirectoryReader.h66
-rw-r--r--WebCore/storage/DirectoryReader.idl37
-rw-r--r--WebCore/storage/EntriesCallback.h52
-rw-r--r--WebCore/storage/EntriesCallback.idl38
-rw-r--r--WebCore/storage/Entry.cpp23
-rw-r--r--WebCore/storage/Entry.h23
-rw-r--r--WebCore/storage/Entry.idl8
-rw-r--r--WebCore/storage/EntryArray.cpp51
-rw-r--r--WebCore/storage/EntryArray.h67
-rw-r--r--WebCore/storage/EntryArray.idl39
-rw-r--r--WebCore/storage/FileEntry.cpp45
-rw-r--r--WebCore/storage/FileEntry.h61
-rw-r--r--WebCore/storage/FileEntry.idl38
-rw-r--r--WebCore/storage/IDBDatabase.cpp1
-rw-r--r--WebCore/storage/IDBDatabase.h4
-rw-r--r--WebCore/storage/IDBDatabaseBackendImpl.cpp75
-rw-r--r--WebCore/storage/IDBDatabaseBackendImpl.h14
-rw-r--r--WebCore/storage/IDBFactory.h2
-rw-r--r--WebCore/storage/IDBFactory.idl2
-rw-r--r--WebCore/storage/IDBFactoryBackendImpl.cpp74
-rw-r--r--WebCore/storage/IDBFactoryBackendImpl.h10
-rw-r--r--WebCore/storage/IDBKeyPath.cpp269
-rw-r--r--WebCore/storage/IDBKeyPath.h64
-rw-r--r--WebCore/storage/IDBObjectStoreBackendImpl.h2
-rw-r--r--WebCore/storage/OriginQuotaManager.h2
-rw-r--r--WebCore/storage/OriginUsageRecord.h5
-rw-r--r--WebCore/storage/SQLStatement.cpp1
-rw-r--r--WebCore/storage/SQLTransactionCoordinator.h2
-rw-r--r--WebCore/storage/StorageAreaSync.h2
-rw-r--r--WebCore/storage/StorageMap.h3
-rw-r--r--WebCore/storage/StorageNamespaceImpl.cpp2
-rw-r--r--WebCore/storage/chromium/QuotaTracker.h2
48 files changed, 1302 insertions, 90 deletions
diff --git a/WebCore/storage/AbstractDatabase.cpp b/WebCore/storage/AbstractDatabase.cpp
index 7827ec8..8d3bf1e 100644
--- a/WebCore/storage/AbstractDatabase.cpp
+++ b/WebCore/storage/AbstractDatabase.cpp
@@ -36,12 +36,12 @@
#include "SQLiteStatement.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
-#include "StringHash.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/StdLibExtras.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/DOMFileSystem.cpp b/WebCore/storage/DOMFileSystem.cpp
index 19c75fc..c3dbd34 100644
--- a/WebCore/storage/DOMFileSystem.cpp
+++ b/WebCore/storage/DOMFileSystem.cpp
@@ -33,7 +33,7 @@
#if ENABLE(FILE_SYSTEM)
-#include "Entry.h"
+#include "DirectoryEntry.h"
namespace WebCore {
@@ -43,9 +43,9 @@ DOMFileSystem::DOMFileSystem(const String& name, const String& rootPath)
{
}
-PassRefPtr<Entry> DOMFileSystem::root()
+PassRefPtr<DirectoryEntry> DOMFileSystem::root()
{
- return Entry::create(this, "/");
+ return DirectoryEntry::create(this, "/");
}
} // namespace
diff --git a/WebCore/storage/DOMFileSystem.h b/WebCore/storage/DOMFileSystem.h
index 454205d..b87aaaf 100644
--- a/WebCore/storage/DOMFileSystem.h
+++ b/WebCore/storage/DOMFileSystem.h
@@ -39,7 +39,7 @@
namespace WebCore {
-class Entry;
+class DirectoryEntry;
class DOMFileSystem : public RefCounted<DOMFileSystem> {
public:
@@ -49,7 +49,7 @@ public:
}
const String& name() const { return m_name; }
- PassRefPtr<Entry> root();
+ PassRefPtr<DirectoryEntry> root();
private:
DOMFileSystem(const String& name, const String& rootPath);
diff --git a/WebCore/storage/DOMFileSystem.idl b/WebCore/storage/DOMFileSystem.idl
index 0241c4a..b7307e2 100644
--- a/WebCore/storage/DOMFileSystem.idl
+++ b/WebCore/storage/DOMFileSystem.idl
@@ -33,6 +33,6 @@ module storage {
Conditional=FILE_SYSTEM
] DOMFileSystem {
readonly attribute DOMString name;
- readonly attribute Entry root;
+ readonly attribute DirectoryEntry root;
};
}
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 9550083..961310d 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -183,13 +183,12 @@ String Database::version() const
bool Database::openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode& e)
{
- if (!m_scriptExecutionContext->databaseThread())
+ DatabaseTaskSynchronizer synchronizer;
+ if (!m_scriptExecutionContext->databaseThread() || m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer))
return false;
bool success = false;
- DatabaseTaskSynchronizer synchronizer;
OwnPtr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, e, success);
-
m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());
synchronizer.waitForTaskCompletion();
@@ -204,14 +203,13 @@ void Database::markAsDeletedAndClose()
LOG(StorageAPI, "Marking %s (%p) as deleted", stringIdentifier().ascii().data(), this);
m_deleted = true;
- if (m_scriptExecutionContext->databaseThread()->terminationRequested()) {
+ DatabaseTaskSynchronizer synchronizer;
+ if (m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer)) {
LOG(StorageAPI, "Database handle %p is on a terminated DatabaseThread, cannot be marked for normal closure\n", this);
return;
}
- DatabaseTaskSynchronizer synchronizer;
OwnPtr<DatabaseCloseTask> task = DatabaseCloseTask::create(this, &synchronizer);
-
m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());
synchronizer.waitForTaskCompletion();
}
@@ -397,12 +395,11 @@ Vector<String> Database::tableNames()
// FIXME: Not using threadsafeCopy on these strings looks ok since threads take strict turns
// in dealing with them. However, if the code changes, this may not be true anymore.
Vector<String> result;
- if (!m_scriptExecutionContext->databaseThread())
+ DatabaseTaskSynchronizer synchronizer;
+ if (!m_scriptExecutionContext->databaseThread() || m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer))
return result;
- DatabaseTaskSynchronizer synchronizer;
OwnPtr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result);
-
m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());
synchronizer.waitForTaskCompletion();
diff --git a/WebCore/storage/DatabaseAuthorizer.h b/WebCore/storage/DatabaseAuthorizer.h
index 66bc5d8..e7c3922 100644
--- a/WebCore/storage/DatabaseAuthorizer.h
+++ b/WebCore/storage/DatabaseAuthorizer.h
@@ -29,10 +29,10 @@
#define DatabaseAuthorizer_h
#include "PlatformString.h"
-#include "StringHash.h"
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/ThreadSafeShared.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/DatabaseTask.cpp b/WebCore/storage/DatabaseTask.cpp
index 3526d9d..343ae1e 100644
--- a/WebCore/storage/DatabaseTask.cpp
+++ b/WebCore/storage/DatabaseTask.cpp
@@ -37,6 +37,9 @@ namespace WebCore {
DatabaseTaskSynchronizer::DatabaseTaskSynchronizer()
: m_taskCompleted(false)
+#ifndef NDEBUG
+ , m_hasCheckedForTermination(false)
+#endif
{
}
@@ -67,6 +70,7 @@ DatabaseTask::DatabaseTask(Database* database, DatabaseTaskSynchronizer* synchro
DatabaseTask::~DatabaseTask()
{
+ ASSERT(m_complete || !m_synchronizer);
}
void DatabaseTask::performTask()
@@ -81,6 +85,10 @@ void DatabaseTask::performTask()
if (m_synchronizer)
m_synchronizer->taskCompleted();
+
+#ifndef NDEBUG
+ m_complete = true;
+#endif
}
// *** DatabaseOpenTask ***
diff --git a/WebCore/storage/DatabaseTask.h b/WebCore/storage/DatabaseTask.h
index 9673a26..847846d 100644
--- a/WebCore/storage/DatabaseTask.h
+++ b/WebCore/storage/DatabaseTask.h
@@ -52,11 +52,19 @@ public:
// Called by the task.
void taskCompleted();
-private:
+#ifndef NDEBUG
+ bool hasCheckedForTermination() const { return m_hasCheckedForTermination; }
+ void setHasCheckedForTermination() { m_hasCheckedForTermination = true; }
+#endif
+
+private:
bool m_taskCompleted;
Mutex m_synchronousMutex;
ThreadCondition m_synchronousCondition;
+#ifndef NDEBUG
+ bool m_hasCheckedForTermination;
+#endif
};
class DatabaseTask : public Noncopyable {
@@ -66,6 +74,10 @@ public:
void performTask();
Database* database() const { return m_database; }
+#ifndef NDEBUG
+ bool hasSynchronizer() const { return m_synchronizer; }
+ bool hasCheckedForTermination() const { return m_synchronizer->hasCheckedForTermination(); }
+#endif
protected:
DatabaseTask(Database*, DatabaseTaskSynchronizer*);
@@ -77,8 +89,8 @@ private:
DatabaseTaskSynchronizer* m_synchronizer;
#ifndef NDEBUG
- virtual const char* debugTaskName() const = 0;
- bool m_complete;
+ virtual const char* debugTaskName() const = 0;
+ bool m_complete;
#endif
};
diff --git a/WebCore/storage/DatabaseThread.cpp b/WebCore/storage/DatabaseThread.cpp
index ae2a6c0..99cf3b9 100644
--- a/WebCore/storage/DatabaseThread.cpp
+++ b/WebCore/storage/DatabaseThread.cpp
@@ -37,6 +37,7 @@
#include "Logging.h"
#include "SQLTransactionClient.h"
#include "SQLTransactionCoordinator.h"
+#include <wtf/UnusedParam.h>
namespace WebCore {
@@ -75,8 +76,15 @@ void DatabaseThread::requestTermination(DatabaseTaskSynchronizer *cleanupSync)
m_queue.kill();
}
-bool DatabaseThread::terminationRequested() const
+bool DatabaseThread::terminationRequested(DatabaseTaskSynchronizer* taskSynchronizer) const
{
+#ifndef NDEBUG
+ if (taskSynchronizer)
+ taskSynchronizer->setHasCheckedForTermination();
+#else
+ UNUSED_PARAM(taskSynchronizer);
+#endif
+
return m_queue.killed();
}
@@ -148,11 +156,13 @@ void DatabaseThread::recordDatabaseClosed(Database* database)
void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task)
{
+ ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination());
m_queue.append(task);
}
void DatabaseThread::scheduleImmediateTask(PassOwnPtr<DatabaseTask> task)
{
+ ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination());
m_queue.prepend(task);
}
diff --git a/WebCore/storage/DatabaseThread.h b/WebCore/storage/DatabaseThread.h
index 3702619..c81e376 100644
--- a/WebCore/storage/DatabaseThread.h
+++ b/WebCore/storage/DatabaseThread.h
@@ -55,7 +55,7 @@ public:
bool start();
void requestTermination(DatabaseTaskSynchronizer* cleanupSync);
- bool terminationRequested() const;
+ bool terminationRequested(DatabaseTaskSynchronizer* taskSynchronizer = 0) const;
void scheduleTask(PassOwnPtr<DatabaseTask>);
void scheduleImmediateTask(PassOwnPtr<DatabaseTask>); // This just adds the task to the front of the queue - the caller needs to be extremely careful not to create deadlocks when waiting for completion.
diff --git a/WebCore/storage/DatabaseTracker.cpp b/WebCore/storage/DatabaseTracker.cpp
index 0764db0..e0ba422 100644
--- a/WebCore/storage/DatabaseTracker.cpp
+++ b/WebCore/storage/DatabaseTracker.cpp
@@ -686,7 +686,11 @@ void DatabaseTracker::setQuota(SecurityOrigin* origin, unsigned long long quota)
}
if (error)
+#if OS(WINDOWS)
+ LOG_ERROR("Failed to set quota %I64u in tracker database for origin %s", quota, origin->databaseIdentifier().ascii().data());
+#else
LOG_ERROR("Failed to set quota %llu in tracker database for origin %s", quota, origin->databaseIdentifier().ascii().data());
+#endif
}
// FIXME: Is it really OK to update the quota in memory if we failed to update it on disk?
diff --git a/WebCore/storage/DatabaseTracker.h b/WebCore/storage/DatabaseTracker.h
index 1557f0a..7145e6b 100644
--- a/WebCore/storage/DatabaseTracker.h
+++ b/WebCore/storage/DatabaseTracker.h
@@ -32,9 +32,9 @@
#if ENABLE(DATABASE)
#include "PlatformString.h"
-#include "StringHash.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
+#include <wtf/text/StringHash.h>
#if !PLATFORM(CHROMIUM)
#include "DatabaseDetails.h"
diff --git a/WebCore/storage/DirectoryEntry.cpp b/WebCore/storage/DirectoryEntry.cpp
new file mode 100644
index 0000000..60dcace
--- /dev/null
+++ b/WebCore/storage/DirectoryEntry.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DirectoryEntry.h"
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "DirectoryReader.h"
+#include "EntryCallback.h"
+#include "ErrorCallback.h"
+
+namespace WebCore {
+
+DirectoryEntry::DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+ : Entry(fileSystem, fullPath)
+{
+}
+
+PassRefPtr<DirectoryReader> DirectoryEntry::createReader()
+{
+ return DirectoryReader::create(m_fileSystem, m_fullPath);
+}
+
+void DirectoryEntry::getFile(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+{
+ // FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
+}
+
+void DirectoryEntry::getDirectory(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+{
+ // FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
+}
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/storage/DirectoryEntry.h b/WebCore/storage/DirectoryEntry.h
new file mode 100644
index 0000000..2ae4fb5
--- /dev/null
+++ b/WebCore/storage/DirectoryEntry.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DirectoryEntry_h
+#define DirectoryEntry_h
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "Entry.h"
+#include "Flags.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class DirectoryReader;
+class EntryCallback;
+class ErrorCallback;
+
+class DirectoryEntry : public Entry {
+public:
+ static PassRefPtr<DirectoryEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+ {
+ return adoptRef(new DirectoryEntry(fileSystem, fullPath));
+ }
+ virtual bool isDirectory() const { return true; }
+
+ PassRefPtr<DirectoryReader> createReader();
+ void getFile(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+ void getDirectory(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+
+private:
+ DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath);
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
+
+#endif // DirectoryEntry_h
diff --git a/WebCore/storage/DirectoryEntry.idl b/WebCore/storage/DirectoryEntry.idl
new file mode 100644
index 0000000..ac30c7f
--- /dev/null
+++ b/WebCore/storage/DirectoryEntry.idl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+ interface [
+ Conditional=FILE_SYSTEM,
+ GenerateNativeConverter,
+ GenerateToJS
+ ] DirectoryEntry : Entry {
+ DirectoryReader createReader();
+ void getFile(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
+ void getDirectory(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
+ };
+}
diff --git a/WebCore/storage/DirectoryReader.cpp b/WebCore/storage/DirectoryReader.cpp
new file mode 100644
index 0000000..0b30f70
--- /dev/null
+++ b/WebCore/storage/DirectoryReader.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DirectoryReader.h"
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "DOMFileSystem.h"
+#include "EntriesCallback.h"
+#include "ErrorCallback.h"
+
+namespace WebCore {
+
+DirectoryReader::DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path)
+ : m_fileSystem(fileSystem)
+ , m_path(path)
+{
+}
+
+void DirectoryReader::readEntries(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>)
+{
+ // FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
+}
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/storage/DirectoryReader.h b/WebCore/storage/DirectoryReader.h
new file mode 100644
index 0000000..cf5da8f
--- /dev/null
+++ b/WebCore/storage/DirectoryReader.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DirectoryReader_h
+#define DirectoryReader_h
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "DOMFileSystem.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class EntriesCallback;
+class ErrorCallback;
+
+class DirectoryReader : public RefCounted<DirectoryReader> {
+public:
+ static PassRefPtr<DirectoryReader> create(PassRefPtr<DOMFileSystem> fileSystem, const String& path)
+ {
+ return adoptRef(new DirectoryReader(fileSystem, path));
+ }
+
+ void readEntries(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback = 0);
+
+private:
+ DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path);
+
+ RefPtr<DOMFileSystem> m_fileSystem;
+ String m_path;
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
+
+#endif // DirectoryReader_h
diff --git a/WebCore/storage/DirectoryReader.idl b/WebCore/storage/DirectoryReader.idl
new file mode 100644
index 0000000..c3c7012
--- /dev/null
+++ b/WebCore/storage/DirectoryReader.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+ interface [
+ Conditional=FILE_SYSTEM
+ ] DirectoryReader {
+ void readEntries(in [Callback] EntriesCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
+ };
+}
diff --git a/WebCore/storage/EntriesCallback.h b/WebCore/storage/EntriesCallback.h
new file mode 100644
index 0000000..9f812e9
--- /dev/null
+++ b/WebCore/storage/EntriesCallback.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EntriesCallback_h
+#define EntriesCallback_h
+
+#if ENABLE(FILE_SYSTEM)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class EntryArray;
+
+class EntriesCallback : public RefCounted<EntriesCallback> {
+public:
+ virtual ~EntriesCallback() { }
+ virtual bool handleEvent(EntryArray*) = 0;
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
+
+#endif // EntriesCallback_h
diff --git a/WebCore/storage/EntriesCallback.idl b/WebCore/storage/EntriesCallback.idl
new file mode 100644
index 0000000..73b374d
--- /dev/null
+++ b/WebCore/storage/EntriesCallback.idl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+ interface [
+ Conditional=FILE_SYSTEM,
+ Callback
+ ] EntriesCallback {
+ boolean handleEvent(in EntryArray entries);
+ };
+}
diff --git a/WebCore/storage/Entry.cpp b/WebCore/storage/Entry.cpp
index b882297..6783291 100644
--- a/WebCore/storage/Entry.cpp
+++ b/WebCore/storage/Entry.cpp
@@ -40,46 +40,51 @@
namespace WebCore {
-Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory)
+Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
: m_fileSystem(fileSystem)
, m_fullPath(fullPath)
- , m_isDirectory(isDirectory)
{
- int index = fullPath.reverseFind("/");
- if (index != -1)
+ size_t index = fullPath.reverseFind("/");
+ if (index != notFound)
m_name = fullPath.substring(index);
else
m_name = fullPath;
}
-void Entry::getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>)
+void Entry::getMetadata(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>)
{
// FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
}
-void Entry::moveTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void Entry::moveTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
{
// FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
}
-void Entry::copyTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void Entry::copyTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
{
// FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
}
-void Entry::remove(ScriptExecutionContext*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>)
+void Entry::remove(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>)
{
// FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
}
-void Entry::getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void Entry::getParent(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
{
// FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
}
String Entry::toURI(const String&)
{
// FIXME: to be implemented.
+ ASSERT_NOT_REACHED();
return String();
}
diff --git a/WebCore/storage/Entry.h b/WebCore/storage/Entry.h
index 1cabe58..7bbb265 100644
--- a/WebCore/storage/Entry.h
+++ b/WebCore/storage/Entry.h
@@ -42,42 +42,35 @@ namespace WebCore {
class EntryCallback;
class ErrorCallback;
class MetadataCallback;
-class ScriptExecutionContext;
class VoidCallback;
class Entry : public RefCounted<Entry> {
public:
- static PassRefPtr<Entry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory = false)
- {
- return adoptRef(new Entry(fileSystem, fullPath, isDirectory));
- }
-
virtual ~Entry() { }
- virtual bool isFile() const { return !m_isDirectory; }
- virtual bool isDirectory() const { return m_isDirectory; }
+ virtual bool isFile() const { return false; }
+ virtual bool isDirectory() const { return false; }
const String& fullPath() const { return m_fullPath; }
const String& name() const { return m_name; }
DOMFileSystem* filesystem() const { return m_fileSystem.get(); }
- virtual void getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+ virtual void getMetadata(PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
- virtual void moveTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
- virtual void copyTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
- virtual void remove(ScriptExecutionContext*, PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
- virtual void getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+ virtual void moveTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+ virtual void copyTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+ virtual void remove(PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+ virtual void getParent(PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
virtual String toURI(const String& mimeType = String());
protected:
- Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory);
+ Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath);
RefPtr<DOMFileSystem> m_fileSystem;
String m_fullPath; // virtual path
String m_name;
- bool m_isDirectory;
};
} // namespace WebCore
diff --git a/WebCore/storage/Entry.idl b/WebCore/storage/Entry.idl
index 972751e..7d4ffee 100644
--- a/WebCore/storage/Entry.idl
+++ b/WebCore/storage/Entry.idl
@@ -38,10 +38,10 @@ module storage {
readonly attribute DOMString fullPath;
readonly attribute DOMFileSystem filesystem;
- [CallWith=ScriptExecutionContext] void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
- [CallWith=ScriptExecutionContext] void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
+ void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
+ void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
+ void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
+ void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
DOMString toURI(in [Optional] DOMString mimeType);
- [CallWith=ScriptExecutionContext] void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
- [CallWith=ScriptExecutionContext] void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
};
}
diff --git a/WebCore/storage/EntryArray.cpp b/WebCore/storage/EntryArray.cpp
new file mode 100644
index 0000000..6c4f74f
--- /dev/null
+++ b/WebCore/storage/EntryArray.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "EntryArray.h"
+
+#if ENABLE(FILE_SYSTEM)
+
+namespace WebCore {
+
+EntryArray::EntryArray()
+{
+}
+
+Entry* EntryArray::item(unsigned index) const
+{
+ if (index >= m_entries.size())
+ return 0;
+ return m_entries[index].get();
+}
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/storage/EntryArray.h b/WebCore/storage/EntryArray.h
new file mode 100644
index 0000000..e5957ab
--- /dev/null
+++ b/WebCore/storage/EntryArray.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EntryArray_h
+#define EntryArray_h
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "Entry.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class EntryArray : public RefCounted<EntryArray> {
+public:
+ static PassRefPtr<EntryArray> create()
+ {
+ return adoptRef(new EntryArray());
+ }
+
+ unsigned length() const { return m_entries.size(); }
+ Entry* item(unsigned index) const;
+ void set(unsigned index, PassRefPtr<Entry> entry);
+
+ bool isEmpty() const { return m_entries.isEmpty(); }
+ void clear() { m_entries.clear(); }
+ void append(PassRefPtr<Entry> entry) { m_entries.append(entry); }
+
+private:
+ EntryArray();
+
+ Vector<RefPtr<Entry> > m_entries;
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
+
+#endif // EntryArray_h
diff --git a/WebCore/storage/EntryArray.idl b/WebCore/storage/EntryArray.idl
new file mode 100644
index 0000000..e987ece
--- /dev/null
+++ b/WebCore/storage/EntryArray.idl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+ interface [
+ Conditional=FILE_SYSTEM,
+ HasIndexGetter,
+ ] EntryArray {
+ readonly attribute unsigned long length;
+ Entry item(in [IsIndex] unsigned long index);
+ };
+}
diff --git a/WebCore/storage/FileEntry.cpp b/WebCore/storage/FileEntry.cpp
new file mode 100644
index 0000000..4bec01d
--- /dev/null
+++ b/WebCore/storage/FileEntry.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FileEntry.h"
+
+#if ENABLE(FILE_SYSTEM)
+
+namespace WebCore {
+
+FileEntry::FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+ : Entry(fileSystem, fullPath)
+{
+}
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/storage/FileEntry.h b/WebCore/storage/FileEntry.h
new file mode 100644
index 0000000..b02b5c7
--- /dev/null
+++ b/WebCore/storage/FileEntry.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FileEntry_h
+#define FileEntry_h
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "Entry.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class DOMFileSystem;
+
+class FileEntry : public Entry {
+public:
+ static PassRefPtr<FileEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+ {
+ return adoptRef(new FileEntry(fileSystem, fullPath));
+ }
+ virtual bool isFile() const { return true; }
+
+private:
+ FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath);
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
+
+#endif // FileEntry_h
diff --git a/WebCore/storage/FileEntry.idl b/WebCore/storage/FileEntry.idl
new file mode 100644
index 0000000..af3b807
--- /dev/null
+++ b/WebCore/storage/FileEntry.idl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+ interface [
+ Conditional=FILE_SYSTEM,
+ GenerateNativeConverter,
+ GenerateToJS
+ ] FileEntry : Entry {
+ };
+}
diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp
index fa1807c..b00695b 100644
--- a/WebCore/storage/IDBDatabase.cpp
+++ b/WebCore/storage/IDBDatabase.cpp
@@ -39,6 +39,7 @@ namespace WebCore {
IDBDatabase::IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface> backend)
: m_backend(backend)
+ , m_description(m_backend->description())
{
// We pass a reference to this object before it can be adopted.
relaxAdoptionRequirement();
diff --git a/WebCore/storage/IDBDatabase.h b/WebCore/storage/IDBDatabase.h
index 6900efd..1ad3c65 100644
--- a/WebCore/storage/IDBDatabase.h
+++ b/WebCore/storage/IDBDatabase.h
@@ -52,7 +52,7 @@ public:
// Implement the IDL
String name() const { return m_backend->name(); }
- String description() const { return m_backend->description(); }
+ String description() const { return m_description; }
String version() const { return m_backend->version(); }
PassRefPtr<DOMStringList> objectStores() const { return m_backend->objectStores(); }
@@ -65,6 +65,8 @@ private:
IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface>);
RefPtr<IDBDatabaseBackendInterface> m_backend;
+
+ String m_description;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp
index 09b9dee..e550e18 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.cpp
+++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp
@@ -29,22 +29,89 @@
#include "DOMStringList.h"
#include "IDBDatabaseException.h"
#include "IDBObjectStoreBackendImpl.h"
+#include "SQLiteDatabase.h"
+#include "SQLiteStatement.h"
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
-IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, const String& version)
- : m_name(name)
- , m_description(description)
- , m_version(version)
+static bool extractMetaData(SQLiteDatabase* sqliteDatabase, const String& expectedName, String& foundDescription, String& foundVersion)
{
+ SQLiteStatement metaDataQuery(*sqliteDatabase, "SELECT name, description, version FROM MetaData");
+ if (metaDataQuery.prepare() != SQLResultOk || metaDataQuery.step() != SQLResultRow)
+ return false;
+
+ if (metaDataQuery.getColumnText(0) != expectedName) {
+ LOG_ERROR("Name in MetaData (%s) doesn't match expected (%s) for IndexedDB", metaDataQuery.getColumnText(0).utf8().data(), expectedName.utf8().data());
+ ASSERT_NOT_REACHED();
+ }
+ foundDescription = metaDataQuery.getColumnText(1);
+ foundVersion = metaDataQuery.getColumnText(2);
+
+ if (metaDataQuery.step() == SQLResultRow) {
+ LOG_ERROR("More than one row found in MetaData table");
+ ASSERT_NOT_REACHED();
+ }
+
+ return true;
+}
+
+static bool setMetaData(SQLiteDatabase* sqliteDatabase, const String& name, const String& description, const String& version)
+{
+ ASSERT(!name.isNull() && !description.isNull() && !version.isNull());
+
+ sqliteDatabase->executeCommand("DELETE FROM MetaData");
+
+ SQLiteStatement insert(*sqliteDatabase, "INSERT INTO MetaData (name, description, version) VALUES (?, ?, ?)");
+ if (insert.prepare() != SQLResultOk) {
+ LOG_ERROR("Failed to prepare MetaData insert statement for IndexedDB");
+ return false;
+ }
+
+ insert.bindText(1, name);
+ insert.bindText(2, description);
+ insert.bindText(3, version);
+
+ if (insert.step() != SQLResultDone) {
+ LOG_ERROR("Failed to insert row into MetaData for IndexedDB");
+ return false;
+ }
+
+ // FIXME: Should we assert there's only one row?
+
+ return true;
+}
+
+IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> sqliteDatabase)
+ : m_sqliteDatabase(sqliteDatabase)
+ , m_name(name)
+ , m_version("")
+{
+ ASSERT(!m_name.isNull());
+
+ // FIXME: The spec is in flux about how to handle description. Sync it up once a final decision is made.
+ String foundDescription = "";
+ bool result = extractMetaData(m_sqliteDatabase.get(), m_name, foundDescription, m_version);
+ m_description = description.isNull() ? foundDescription : description;
+
+ if (!result || m_description != foundDescription)
+ setMetaData(m_sqliteDatabase.get(), m_name, m_description, m_version);
}
IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl()
{
}
+void IDBDatabaseBackendImpl::setDescription(const String& description)
+{
+ if (description == m_description)
+ return;
+
+ m_description = description;
+ setMetaData(m_sqliteDatabase.get(), m_name, m_description, m_version);
+}
+
PassRefPtr<DOMStringList> IDBDatabaseBackendImpl::objectStores() const
{
RefPtr<DOMStringList> objectStoreNames = DOMStringList::create();
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h
index f6ff058..60bec1f 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.h
+++ b/WebCore/storage/IDBDatabaseBackendImpl.h
@@ -28,21 +28,25 @@
#include "IDBCallbacks.h"
#include "IDBDatabase.h"
-#include "StringHash.h"
#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
+class SQLiteDatabase;
+
class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface {
public:
- static PassRefPtr<IDBDatabaseBackendInterface> create(const String& name, const String& description, const String& version)
+ static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database)
{
- return adoptRef(new IDBDatabaseBackendImpl(name, description, version));
+ return adoptRef(new IDBDatabaseBackendImpl(name, description, database));
}
virtual ~IDBDatabaseBackendImpl();
+ void setDescription(const String& description);
+
// Implements IDBDatabase
virtual String name() const { return m_name; }
virtual String description() const { return m_description; }
@@ -54,7 +58,9 @@ public:
virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>);
virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout);
private:
- IDBDatabaseBackendImpl(const String& name, const String& description, const String& version);
+ IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database);
+
+ OwnPtr<SQLiteDatabase> m_sqliteDatabase;
String m_name;
String m_description;
diff --git a/WebCore/storage/IDBFactory.h b/WebCore/storage/IDBFactory.h
index 61619b9..a96aa38 100644
--- a/WebCore/storage/IDBFactory.h
+++ b/WebCore/storage/IDBFactory.h
@@ -54,7 +54,7 @@ public:
}
~IDBFactory();
- PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description);
+ PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description = String());
private:
IDBFactory(IDBFactoryBackendInterface*);
diff --git a/WebCore/storage/IDBFactory.idl b/WebCore/storage/IDBFactory.idl
index cd887f0..215d67c 100644
--- a/WebCore/storage/IDBFactory.idl
+++ b/WebCore/storage/IDBFactory.idl
@@ -28,7 +28,7 @@ module storage {
interface [
Conditional=INDEXED_DATABASE
] IDBFactory {
- [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in DOMString description);
+ [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in [Optional, ConvertUndefinedOrNullToNullString] DOMString description);
};
}
diff --git a/WebCore/storage/IDBFactoryBackendImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp
index 7bdd70d..905726f 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.cpp
+++ b/WebCore/storage/IDBFactoryBackendImpl.cpp
@@ -30,7 +30,10 @@
#include "IDBFactoryBackendImpl.h"
#include "DOMStringList.h"
+#include "FileSystem.h"
#include "IDBDatabaseBackendImpl.h"
+#include "IDBDatabaseException.h"
+#include "SQLiteDatabase.h"
#include "SecurityOrigin.h"
#include <wtf/Threading.h>
#include <wtf/UnusedParam.h>
@@ -39,31 +42,74 @@
namespace WebCore {
-PassRefPtr<IDBFactoryBackendImpl> IDBFactoryBackendImpl::create()
+IDBFactoryBackendImpl::IDBFactoryBackendImpl()
{
- return adoptRef(new IDBFactoryBackendImpl);
}
-IDBFactoryBackendImpl::IDBFactoryBackendImpl()
+IDBFactoryBackendImpl::~IDBFactoryBackendImpl()
{
}
-IDBFactoryBackendImpl::~IDBFactoryBackendImpl()
+static PassOwnPtr<SQLiteDatabase> openSQLiteDatabase(SecurityOrigin* securityOrigin, String name)
{
+ String pathBase = "/tmp/temporary-indexed-db-files"; // FIXME: Write a PageGroupSettings class and have this value come from that.
+ if (!makeAllDirectories(pathBase)) {
+ // FIXME: Is there any other thing we could possibly do to recover at this point? If so, do it rather than just erroring out.
+ LOG_ERROR("Unabled to create LocalStorage database path %s", pathBase.utf8().data());
+ return 0;
+ }
+
+ String databaseIdentifier = securityOrigin->databaseIdentifier();
+ String santizedName = encodeForFileName(name);
+ String path = pathByAppendingComponent(pathBase, databaseIdentifier + "_" + santizedName + ".indexeddb");
+
+ OwnPtr<SQLiteDatabase> sqliteDatabase = adoptPtr(new SQLiteDatabase());
+ if (!sqliteDatabase->open(path)) {
+ // FIXME: Is there any other thing we could possibly do to recover at this point? If so, do it rather than just erroring out.
+ LOG_ERROR("Failed to open database file %s for IndexedDB", path.utf8().data());
+ return 0;
+ }
+
+ return sqliteDatabase.release();
}
-void IDBFactoryBackendImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*)
+static bool createTables(SQLiteDatabase* sqliteDatabase)
+{
+ static const char* commands[] = {
+ "CREATE TABLE IF NOT EXISTS MetaData (name TEXT, description TEXT, version TEXT)"
+ };
+
+ for (size_t i = 0; i < arraysize(commands); ++i) {
+ if (!sqliteDatabase->executeCommand(commands[i])) {
+ // FIXME: We should try to recover from this situation. Maybe nuke the database and start over?
+ LOG_ERROR("Failed to run the following command for IndexedDB: %s", commands[i]);
+ return false;
+ }
+ }
+ return true;
+}
+
+void IDBFactoryBackendImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*)
{
- RefPtr<IDBDatabaseBackendInterface> databaseBackend;
IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(name);
- if (it == m_databaseBackendMap.end()) {
- // FIXME: What should the version be? The spec doesn't define it yet.
- databaseBackend = IDBDatabaseBackendImpl::create(name, description, "");
- m_databaseBackendMap.set(name, databaseBackend);
- } else
- databaseBackend = it->second;
-
- callbacks->onSuccess(databaseBackend.release());
+ if (it != m_databaseBackendMap.end()) {
+ if (!description.isNull())
+ it->second->setDescription(description); // The description may have changed.
+ callbacks->onSuccess(it->second.get());
+ return;
+ }
+
+ // FIXME: Everything from now on should be done on another thread.
+
+ OwnPtr<SQLiteDatabase> sqliteDatabase = openSQLiteDatabase(securityOrigin.get(), name);
+ if (!sqliteDatabase || !createTables(sqliteDatabase.get())) {
+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error."));
+ return;
+ }
+
+ RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, description, sqliteDatabase.release());
+ callbacks->onSuccess(databaseBackend.get());
+ m_databaseBackendMap.set(name, databaseBackend.release());
}
} // namespace WebCore
diff --git a/WebCore/storage/IDBFactoryBackendImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h
index bbcc537..e87ea39 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.h
+++ b/WebCore/storage/IDBFactoryBackendImpl.h
@@ -29,18 +29,22 @@
#define IDBFactoryBackendImpl_h
#include "IDBFactoryBackendInterface.h"
-#include "StringHash.h"
#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
class DOMStringList;
+class IDBDatabaseBackendImpl;
class IDBFactoryBackendImpl : public IDBFactoryBackendInterface {
public:
- static PassRefPtr<IDBFactoryBackendImpl> create();
+ static PassRefPtr<IDBFactoryBackendImpl> create()
+ {
+ return adoptRef(new IDBFactoryBackendImpl());
+ }
virtual ~IDBFactoryBackendImpl();
virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*);
@@ -48,7 +52,7 @@ public:
private:
IDBFactoryBackendImpl();
- typedef HashMap<String, RefPtr<IDBDatabaseBackendInterface> > IDBDatabaseBackendMap;
+ typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap;
IDBDatabaseBackendMap m_databaseBackendMap;
// We only create one instance of this class at a time.
diff --git a/WebCore/storage/IDBKeyPath.cpp b/WebCore/storage/IDBKeyPath.cpp
new file mode 100644
index 0000000..8833da0
--- /dev/null
+++ b/WebCore/storage/IDBKeyPath.cpp
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBKeyPath.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/ASCIICType.h>
+#include <wtf/dtoa.h>
+
+namespace WebCore {
+
+class IDBKeyPathLexer {
+public:
+ enum TokenType {
+ TokenLeftBracket,
+ TokenRightBracket,
+ TokenIdentifier,
+ TokenNumber,
+ TokenDot,
+ TokenEnd,
+ TokenError
+ };
+
+ explicit IDBKeyPathLexer(const String& s)
+ : m_string(s)
+ , m_ptr(s.characters())
+ , m_end(s.characters() + s.length())
+ , m_currentTokenType(TokenError)
+ {
+ }
+
+ TokenType currentTokenType() const { return m_currentTokenType; }
+
+ TokenType nextTokenType()
+ {
+ m_currentTokenType = lex(m_currentElement);
+ return m_currentTokenType;
+ }
+
+ const IDBKeyPathElement& currentElement() { return m_currentElement; }
+
+private:
+ TokenType lex(IDBKeyPathElement&);
+ TokenType lexIdentifier(IDBKeyPathElement&);
+ TokenType lexNumber(IDBKeyPathElement&);
+ IDBKeyPathElement m_currentElement;
+ String m_string;
+ const UChar* m_ptr;
+ const UChar* m_end;
+ TokenType m_currentTokenType;
+};
+
+IDBKeyPathLexer::TokenType IDBKeyPathLexer::lex(IDBKeyPathElement& element)
+{
+ while (m_ptr < m_end && isASCIISpace(*m_ptr))
+ ++m_ptr;
+
+ if (m_ptr >= m_end)
+ return TokenEnd;
+
+ ASSERT(m_ptr < m_end);
+ switch (*m_ptr) {
+ case '[':
+ ++m_ptr;
+ return TokenLeftBracket;
+ case ']':
+ ++m_ptr;
+ return TokenRightBracket;
+ case '.':
+ ++m_ptr;
+ return TokenDot;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ return lexNumber(element);
+ default:
+ return lexIdentifier(element);
+ }
+ return TokenError;
+}
+
+static inline bool isSafeIdentifierStartCharacter(UChar c)
+{
+ return isASCIIAlpha(c) || (c == '_') || (c == '$');
+}
+
+static inline bool isSafeIdentifierCharacter(UChar c)
+{
+ return isASCIIAlphanumeric(c) || (c == '_') || (c == '$');
+}
+
+IDBKeyPathLexer::TokenType IDBKeyPathLexer::lexIdentifier(IDBKeyPathElement& element)
+{
+ const UChar* start = m_ptr;
+ if (m_ptr < m_end && isSafeIdentifierStartCharacter(*m_ptr))
+ ++m_ptr;
+ else
+ return TokenError;
+
+ while (m_ptr < m_end && isSafeIdentifierCharacter(*m_ptr))
+ ++m_ptr;
+
+ element.type = IDBKeyPathElement::IsNamed;
+ element.identifier = String(start, m_ptr - start);
+ return TokenIdentifier;
+}
+
+IDBKeyPathLexer::TokenType IDBKeyPathLexer::lexNumber(IDBKeyPathElement& element)
+{
+ if (m_ptr >= m_end)
+ return TokenError;
+
+ const UChar* start = m_ptr;
+ // [0-9]*
+ while (m_ptr < m_end && isASCIIDigit(*m_ptr))
+ ++m_ptr;
+
+ String numberAsString;
+ numberAsString = String(start, m_ptr - start);
+ bool ok = false;
+ unsigned number = numberAsString.toUIntStrict(&ok);
+ if (!ok)
+ return TokenError;
+
+ element.type = IDBKeyPathElement::IsIndexed;
+ element.index = number;
+ return TokenNumber;
+}
+
+void IDBParseKeyPath(const String& keyPath, Vector<IDBKeyPathElement>& elements, IDBKeyPathParseError& error)
+{
+ // This is a simplified parser loosely based on LiteralParser.
+ // An IDBKeyPath is defined as a sequence of:
+ // identifierA{.identifierB{[numeric_value]}
+ // where "{}" represents an optional part
+ // The basic state machine is:
+ // Start => {Identifier, Array}
+ // Identifier => {Dot, Array, End}
+ // Array => {Start, Dot, End}
+ // Dot => {Identifier}
+ // It bails out as soon as it finds an error, but doesn't discard the bits it managed to parse.
+ enum ParserState { Identifier, Array, Dot, End };
+
+ IDBKeyPathLexer lexer(keyPath);
+ IDBKeyPathLexer::TokenType tokenType = lexer.nextTokenType();
+ ParserState state;
+ if (tokenType == IDBKeyPathLexer::TokenIdentifier)
+ state = Identifier;
+ else if (tokenType == IDBKeyPathLexer::TokenLeftBracket)
+ state = Array;
+ else if (tokenType == IDBKeyPathLexer::TokenEnd)
+ state = End;
+ else {
+ error = IDBKeyPathParseErrorStart;
+ return;
+ }
+
+ while (1) {
+ switch (state) {
+ case Identifier : {
+ IDBKeyPathLexer::TokenType tokenType = lexer.currentTokenType();
+ ASSERT(tokenType == IDBKeyPathLexer::TokenIdentifier);
+
+ IDBKeyPathElement element = lexer.currentElement();
+ ASSERT(element.type == IDBKeyPathElement::IsNamed);
+ elements.append(element);
+
+ tokenType = lexer.nextTokenType();
+ if (tokenType == IDBKeyPathLexer::TokenDot)
+ state = Dot;
+ else if (tokenType == IDBKeyPathLexer::TokenLeftBracket)
+ state = Array;
+ else if (tokenType == IDBKeyPathLexer::TokenEnd)
+ state = End;
+ else {
+ error = IDBKeyPathParseErrorIdentifier;
+ return;
+ }
+ break;
+ }
+ case Array : {
+ IDBKeyPathLexer::TokenType tokenType = lexer.currentTokenType();
+ ASSERT(tokenType == IDBKeyPathLexer::TokenLeftBracket);
+
+ tokenType = lexer.nextTokenType();
+ if (tokenType != IDBKeyPathLexer::TokenNumber) {
+ error = IDBKeyPathParseErrorArrayIndex;
+ return;
+ }
+
+ ASSERT(tokenType == IDBKeyPathLexer::TokenNumber);
+ IDBKeyPathElement element = lexer.currentElement();
+ ASSERT(element.type == IDBKeyPathElement::IsIndexed);
+ elements.append(element);
+
+ tokenType = lexer.nextTokenType();
+ if (tokenType != IDBKeyPathLexer::TokenRightBracket) {
+ error = IDBKeyPathParseErrorArrayIndex;
+ return;
+ }
+
+ tokenType = lexer.nextTokenType();
+ if (tokenType == IDBKeyPathLexer::TokenDot)
+ state = Dot;
+ else if (tokenType == IDBKeyPathLexer::TokenLeftBracket)
+ state = Array;
+ else if (tokenType == IDBKeyPathLexer::TokenEnd)
+ state = End;
+ else {
+ error = IDBKeyPathParseErrorAfterArray;
+ return;
+ }
+ break;
+ }
+ case Dot: {
+ IDBKeyPathLexer::TokenType tokenType = lexer.currentTokenType();
+ ASSERT(tokenType == IDBKeyPathLexer::TokenDot);
+
+ tokenType = lexer.nextTokenType();
+ if (tokenType != IDBKeyPathLexer::TokenIdentifier) {
+ error = IDBKeyPathParseErrorDot;
+ return;
+ }
+
+ state = Identifier;
+ break;
+ }
+ case End: {
+ error = IDBKeyPathParseErrorNone;
+ return;
+ }
+ }
+ }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBKeyPath.h b/WebCore/storage/IDBKeyPath.h
new file mode 100644
index 0000000..7787980
--- /dev/null
+++ b/WebCore/storage/IDBKeyPath.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBKeyPath_h
+#define IDBKeyPath_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct IDBKeyPathElement {
+ enum Type {
+ IsIndexed,
+ IsNamed,
+ };
+
+ Type type;
+ unsigned index;
+ String identifier;
+};
+
+enum IDBKeyPathParseError {
+ IDBKeyPathParseErrorNone,
+ IDBKeyPathParseErrorStart,
+ IDBKeyPathParseErrorIdentifier,
+ IDBKeyPathParseErrorArrayIndex,
+ IDBKeyPathParseErrorAfterArray,
+ IDBKeyPathParseErrorDot,
+};
+
+void IDBParseKeyPath(const String&, Vector<IDBKeyPathElement>&, IDBKeyPathParseError&);
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBKeyPath_h
diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.h b/WebCore/storage/IDBObjectStoreBackendImpl.h
index fc63658..4b909af 100644
--- a/WebCore/storage/IDBObjectStoreBackendImpl.h
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.h
@@ -27,8 +27,8 @@
#define IDBObjectStoreBackendImpl_h
#include "IDBObjectStoreBackendInterface.h"
-#include "StringHash.h"
#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
#if ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/OriginQuotaManager.h b/WebCore/storage/OriginQuotaManager.h
index c904737..ec9620c 100644
--- a/WebCore/storage/OriginQuotaManager.h
+++ b/WebCore/storage/OriginQuotaManager.h
@@ -31,10 +31,10 @@
#if ENABLE(DATABASE)
-#include "StringHash.h"
#include "SecurityOriginHash.h"
#include <wtf/HashMap.h>
#include <wtf/Threading.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/OriginUsageRecord.h b/WebCore/storage/OriginUsageRecord.h
index 25bddf2..a830e68 100644
--- a/WebCore/storage/OriginUsageRecord.h
+++ b/WebCore/storage/OriginUsageRecord.h
@@ -31,10 +31,9 @@
#if ENABLE(DATABASE)
#include "PlatformString.h"
-#include "StringHash.h"
-
#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
+#include <wtf/HashSet.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp
index 3973157..19e9e38 100644
--- a/WebCore/storage/SQLStatement.cpp
+++ b/WebCore/storage/SQLStatement.cpp
@@ -39,6 +39,7 @@
#include "SQLStatementErrorCallback.h"
#include "SQLTransaction.h"
#include "SQLValue.h"
+#include <wtf/text/CString.h>
namespace WebCore {
diff --git a/WebCore/storage/SQLTransactionCoordinator.h b/WebCore/storage/SQLTransactionCoordinator.h
index 247ad13..94360c0 100644
--- a/WebCore/storage/SQLTransactionCoordinator.h
+++ b/WebCore/storage/SQLTransactionCoordinator.h
@@ -33,11 +33,11 @@
#if ENABLE(DATABASE)
-#include "StringHash.h"
#include <wtf/Deque.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/RefPtr.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/StorageAreaSync.h b/WebCore/storage/StorageAreaSync.h
index 94c4670..90aa6a7 100644
--- a/WebCore/storage/StorageAreaSync.h
+++ b/WebCore/storage/StorageAreaSync.h
@@ -29,9 +29,9 @@
#if ENABLE(DOM_STORAGE)
#include "SQLiteDatabase.h"
-#include "StringHash.h"
#include "Timer.h"
#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/StorageMap.h b/WebCore/storage/StorageMap.h
index fa5f46c..d162124 100644
--- a/WebCore/storage/StorageMap.h
+++ b/WebCore/storage/StorageMap.h
@@ -29,11 +29,10 @@
#if ENABLE(DOM_STORAGE)
#include "PlatformString.h"
-#include "StringHash.h"
-
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/StorageNamespaceImpl.cpp b/WebCore/storage/StorageNamespaceImpl.cpp
index 557dd76..0f07e07 100644
--- a/WebCore/storage/StorageNamespaceImpl.cpp
+++ b/WebCore/storage/StorageNamespaceImpl.cpp
@@ -29,11 +29,11 @@
#if ENABLE(DOM_STORAGE)
#include "SecurityOriginHash.h"
-#include "StringHash.h"
#include "StorageAreaImpl.h"
#include "StorageMap.h"
#include "StorageSyncManager.h"
#include <wtf/StdLibExtras.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/storage/chromium/QuotaTracker.h b/WebCore/storage/chromium/QuotaTracker.h
index b913563..774475e 100644
--- a/WebCore/storage/chromium/QuotaTracker.h
+++ b/WebCore/storage/chromium/QuotaTracker.h
@@ -35,8 +35,8 @@
#include "PlatformString.h"
#include "SecurityOrigin.h"
-#include "StringHash.h"
#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {