1/* 2 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * This library is distributed in the hope that i will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public License 19 * along with this library; see the file COPYING.LIB. If not, write to 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 */ 23 24#ifndef DatabaseThreadWince_h 25#define DatabaseThreadWince_h 26 27#include <wtf/Deque.h> 28#include <wtf/RefCounted.h> 29 30namespace WebCore { 31 32 class Database; 33 class DatabaseTask; 34 35 class DatabaseThread: public WTF::RefCounted<DatabaseThread> { 36 37 public: 38 static PassRefPtr<DatabaseThread> create() { return adoptRef(new DatabaseThread); } 39 ~DatabaseThread(); 40 41 bool start() { return true; } 42 void requestTermination(); 43 bool terminationRequested() const; 44 45 void scheduleTask(PassRefPtr<DatabaseTask>); 46 void scheduleImmediateTask(PassRefPtr<DatabaseTask>); 47 void unscheduleDatabaseTasks(Database*); 48 void recordDatabaseOpen(Database*); 49 void recordDatabaseClosed(Database*); 50#ifndef NDEBUG 51 ThreadIdentifier getThreadID() const { return currentThread(); } 52#endif 53 54 private: 55 DatabaseThread(); 56 57 void timerFired(Timer<DatabaseThread>*); 58 59 Deque<RefPtr<DatabaseTask> > m_queue; 60 Timer<DatabaseThread> m_timer; 61 }; 62 63} // namespace WebCore 64 65#endif // DatabaseThreadWince 66