#ifndef DatabaseManager_h
#define DatabaseManager_h
-#include "modules/webdatabase/DatabaseBasicTypes.h"
#include "modules/webdatabase/DatabaseContext.h"
#include "modules/webdatabase/DatabaseError.h"
#include "platform/heap/Handle.h"
#include "wtf/Assertions.h"
+#include "wtf/Forward.h"
#include "wtf/HashMap.h"
#include "wtf/PassRefPtr.h"
-#include "wtf/ThreadingPrimitives.h"
-#include "wtf/text/WTFString.h"
namespace blink {
-class AbstractDatabaseServer;
class Database;
-class DatabaseBackendBase;
class DatabaseCallback;
class DatabaseContext;
-class DatabaseSync;
-class TaskSynchronizer;
class ExceptionState;
class SecurityOrigin;
class ExecutionContext;
-typedef int ExceptionCode;
-
class DatabaseManager {
WTF_MAKE_NONCOPYABLE(DatabaseManager); WTF_MAKE_FAST_ALLOCATED;
public:
static void throwExceptionForDatabaseError(DatabaseError, const String& errorMessage, ExceptionState&);
- PassRefPtrWillBeRawPtr<Database> openDatabase(ExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, PassOwnPtr<DatabaseCallback>, DatabaseError&, String& errorMessage);
- PassRefPtrWillBeRawPtr<DatabaseSync> openDatabaseSync(ExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, PassOwnPtr<DatabaseCallback>, DatabaseError&, String& errorMessage);
+ PassRefPtrWillBeRawPtr<Database> openDatabase(ExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, DatabaseCallback*, DatabaseError&, String& errorMessage);
String fullPathForDatabase(SecurityOrigin*, const String& name, bool createIfDoesNotExist = true);
- void closeDatabasesImmediately(const String& originIdentifier, const String& name);
-
- void interruptAllDatabasesForContext(DatabaseContext*);
-
private:
DatabaseManager();
~DatabaseManager();
// it already exist previously. Otherwise, it returns 0.
DatabaseContext* existingDatabaseContextFor(ExecutionContext*);
- PassRefPtrWillBeRawPtr<DatabaseBackendBase> openDatabaseBackend(ExecutionContext*,
- DatabaseType, const String& name, const String& expectedVersion, const String& displayName,
+ PassRefPtrWillBeRawPtr<Database> openDatabaseInternal(ExecutionContext*,
+ const String& name, const String& expectedVersion, const String& displayName,
unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError&, String& errorMessage);
static void logErrorMessage(ExecutionContext*, const String& message);
- AbstractDatabaseServer* m_server;
-
- // Access to the following fields require locking m_contextMapLock:
-#if ENABLE(OILPAN)
- // We can't use PersistentHeapHashMap because multiple threads update the map.
- typedef HashMap<ExecutionContext*, OwnPtr<Persistent<DatabaseContext> > > ContextMap;
-#else
- typedef HashMap<ExecutionContext*, RefPtr<DatabaseContext> > ContextMap;
-#endif
+ typedef WillBePersistentHeapHashMap<ExecutionContext*, RefPtrWillBeMember<DatabaseContext> > ContextMap;
ContextMap m_contextMap;
#if ENABLE(ASSERT)
int m_databaseContextRegisteredCount;
int m_databaseContextInstanceCount;
#endif
- Mutex m_contextMapLock;
};
} // namespace blink