summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/wince
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /WebCore/storage/wince
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'WebCore/storage/wince')
-rw-r--r--WebCore/storage/wince/DatabaseThreadWince.cpp95
-rw-r--r--WebCore/storage/wince/DatabaseThreadWince.h65
-rw-r--r--WebCore/storage/wince/LocalStorageThreadWince.cpp83
-rw-r--r--WebCore/storage/wince/LocalStorageThreadWince.h58
4 files changed, 301 insertions, 0 deletions
diff --git a/WebCore/storage/wince/DatabaseThreadWince.cpp b/WebCore/storage/wince/DatabaseThreadWince.cpp
new file mode 100644
index 0000000..d81145d
--- /dev/null
+++ b/WebCore/storage/wince/DatabaseThreadWince.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2009 Torch Mobile, 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 library is distributed in the hope that i will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "DatabaseThread.h"
+
+#include "Database.h"
+#include "DatabaseTask.h"
+
+namespace WebCore {
+
+DatabaseThread::DatabaseThread()
+: m_timer(this, &DatabaseThread::timerFired)
+{
+}
+
+DatabaseThread::~DatabaseThread()
+{
+}
+
+void DatabaseThread::requestTermination()
+{
+ m_queue.clear();
+}
+
+bool DatabaseThread::terminationRequested() const
+{
+ return m_queue.isEmpty();
+}
+
+void DatabaseThread::timerFired(Timer<DatabaseThread>*)
+{
+ if (!m_queue.isEmpty()) {
+ RefPtr<DatabaseTask> task = m_queue.first();
+ task->performTask();
+ m_queue.removeFirst();
+ if (!m_queue.isEmpty())
+ m_timer.startOneShot(0);
+ }
+}
+
+void DatabaseThread::scheduleTask(PassRefPtr<DatabaseTask> task)
+{
+ m_queue.append(task);
+ if (!m_timer.isActive())
+ m_timer.startOneShot(0);
+}
+
+void DatabaseThread::scheduleImmediateTask(PassRefPtr<DatabaseTask> task)
+{
+ task->performTask();
+}
+
+void DatabaseThread::unscheduleDatabaseTasks(Database* database)
+{
+ Deque<RefPtr<DatabaseTask> > reservedTasks;
+ for (Deque<RefPtr<DatabaseTask> >::const_iterator i = m_queue.begin(); i != m_queue.end(); ++i) {
+ if ((*i)->database() != database)
+ reservedTasks.append(*i);
+ }
+
+ m_queue.swap(reservedTasks);
+}
+
+void DatabaseThread::recordDatabaseOpen(Database* database)
+{
+ notImplemented();
+}
+
+void DatabaseThread::recordDatabaseClosed(Database* database)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
diff --git a/WebCore/storage/wince/DatabaseThreadWince.h b/WebCore/storage/wince/DatabaseThreadWince.h
new file mode 100644
index 0000000..fafc791
--- /dev/null
+++ b/WebCore/storage/wince/DatabaseThreadWince.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2009 Torch Mobile, 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 library is distributed in the hope that i will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef DatabaseThreadWince_h
+#define DatabaseThreadWince_h
+
+#include <wtf/Deque.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Database;
+ class DatabaseTask;
+
+ class DatabaseThread: public WTF::RefCounted<DatabaseThread> {
+
+ public:
+ static PassRefPtr<DatabaseThread> create() { return adoptRef(new DatabaseThread); }
+ ~DatabaseThread();
+
+ bool start() { return true; }
+ void requestTermination();
+ bool terminationRequested() const;
+
+ void scheduleTask(PassRefPtr<DatabaseTask>);
+ void scheduleImmediateTask(PassRefPtr<DatabaseTask>);
+ void unscheduleDatabaseTasks(Database*);
+ void recordDatabaseOpen(Database*);
+ void recordDatabaseClosed(Database*);
+#ifndef NDEBUG
+ ThreadIdentifier getThreadID() const { return currentThread(); }
+#endif
+
+ private:
+ DatabaseThread();
+
+ void timerFired(Timer<DatabaseThread>*);
+
+ Deque<RefPtr<DatabaseTask> > m_queue;
+ Timer<DatabaseThread> m_timer;
+ };
+
+} // namespace WebCore
+
+#endif // DatabaseThreadWince
diff --git a/WebCore/storage/wince/LocalStorageThreadWince.cpp b/WebCore/storage/wince/LocalStorageThreadWince.cpp
new file mode 100644
index 0000000..8dcb902
--- /dev/null
+++ b/WebCore/storage/wince/LocalStorageThreadWince.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2009 Torch Mobile, 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 library is distributed in the hope that i will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "LocalStorageThread.h"
+
+#include "LocalStorageTask.h"
+#include "StorageAreaSync.h"
+
+namespace WebCore {
+
+LocalStorageThread::LocalStorageThread()
+: m_timer(this, &LocalStorageThread::timerFired)
+{
+}
+
+LocalStorageThread::~LocalStorageThread()
+{
+}
+
+bool LocalStorageThread::start()
+{
+ return true;
+}
+
+void LocalStorageThread::timerFired(Timer<LocalStorageThread>*)
+{
+ if (!m_queue.isEmpty()) {
+ RefPtr<LocalStorageTask> task = m_queue.first();
+ task->performTask();
+ m_queue.removeFirst();
+ if (!m_queue.isEmpty())
+ m_timer.startOneShot(0);
+ }
+}
+
+void LocalStorageThread::scheduleImport(PassRefPtr<StorageAreaSync> area)
+{
+ m_queue.append(LocalStorageTask::createImport(area));
+ if (!m_timer.isActive())
+ m_timer.startOneShot(0);
+}
+
+void LocalStorageThread::scheduleSync(PassRefPtr<StorageAreaSync> area)
+{
+ m_queue.append(LocalStorageTask::createSync(area));
+ if (!m_timer.isActive())
+ m_timer.startOneShot(0);
+}
+
+void LocalStorageThread::terminate()
+{
+ m_queue.clear();
+ m_timer.stop();
+}
+
+void LocalStorageThread::performTerminate()
+{
+ m_queue.clear();
+ m_timer.stop();
+}
+
+}
diff --git a/WebCore/storage/wince/LocalStorageThreadWince.h b/WebCore/storage/wince/LocalStorageThreadWince.h
new file mode 100644
index 0000000..300abb5
--- /dev/null
+++ b/WebCore/storage/wince/LocalStorageThreadWince.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 Torch Mobile, 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 library is distributed in the hope that i will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef LocalStorageThreadWince_h
+#define LocalStorageThreadWince_h
+
+#include <wtf/Deque.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+ class StorageAreaSync;
+ class LocalStorageTask;
+
+ class LocalStorageThread : public RefCounted<LocalStorageThread> {
+ public:
+ static PassRefPtr<LocalStorageThread> create() { return adoptRef(new LocalStorageThread); }
+
+ ~LocalStorageThread();
+ bool start();
+ void scheduleImport(PassRefPtr<StorageAreaSync>);
+ void scheduleSync(PassRefPtr<StorageAreaSync>);
+ void terminate();
+ void performTerminate();
+
+ private:
+ LocalStorageThread();
+
+ void timerFired(Timer<LocalStorageThread>*);
+
+ Deque<RefPtr<LocalStorageTask> > m_queue;
+ Timer<LocalStorageThread> m_timer;
+ };
+
+} // namespace WebCore
+
+#endif // LocalStorageThreadWince_h