summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/wince/DatabaseThreadWinCE.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-09-29 17:32:26 +0100
committerSteve Block <steveblock@google.com>2010-09-29 17:35:08 +0100
commit68513a70bcd92384395513322f1b801e7bf9c729 (patch)
tree161b50f75a5921d61731bb25e730005994fcec85 /WebCore/storage/wince/DatabaseThreadWinCE.cpp
parentfd5c6425ce58eb75211be7718d5dee960842a37e (diff)
downloadexternal_webkit-68513a70bcd92384395513322f1b801e7bf9c729.zip
external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.gz
external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.bz2
Merge WebKit at r67908: Initial merge by Git
Change-Id: I43a553e7b3299b28cb6ee8aa035ed70fe342b972
Diffstat (limited to 'WebCore/storage/wince/DatabaseThreadWinCE.cpp')
-rw-r--r--WebCore/storage/wince/DatabaseThreadWinCE.cpp95
1 files changed, 95 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