| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 #ifndef IDBFactoryBackendImpl_h | 28 #ifndef IDBFactoryBackendImpl_h |
| 29 #define IDBFactoryBackendImpl_h | 29 #define IDBFactoryBackendImpl_h |
| 30 | 30 |
| 31 #include "core/page/SecurityOrigin.h" | |
| 32 #include "modules/indexeddb/IDBCallbacks.h" | 31 #include "modules/indexeddb/IDBCallbacks.h" |
| 33 #include "modules/indexeddb/IDBDatabaseCallbacks.h" | 32 #include "modules/indexeddb/IDBDatabaseCallbacks.h" |
| 34 #include "modules/indexeddb/IDBFactoryBackendInterface.h" | 33 #include "modules/indexeddb/IDBFactoryBackendInterface.h" |
| 35 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
| 36 #include "wtf/HashSet.h" | 35 #include "wtf/HashSet.h" |
| 37 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 38 #include "wtf/WeakPtr.h" | 37 #include "wtf/WeakPtr.h" |
| 39 #include "wtf/text/StringHash.h" | 38 #include "wtf/text/StringHash.h" |
| 40 | 39 |
| 41 namespace WebCore { | 40 namespace WebCore { |
| 42 | 41 |
| 43 class DOMStringList; | 42 class DOMStringList; |
| 44 | 43 |
| 45 class IDBBackingStore; | 44 class IDBBackingStore; |
| 46 class IDBDatabaseBackendImpl; | 45 class IDBDatabaseBackendImpl; |
| 47 | 46 |
| 48 class IDBFactoryBackendImpl : public IDBFactoryBackendInterface { | 47 class IDBFactoryBackendImpl : public IDBFactoryBackendInterface { |
| 49 public: | 48 public: |
| 50 static PassRefPtr<IDBFactoryBackendImpl> create() | 49 static PassRefPtr<IDBFactoryBackendImpl> create() |
| 51 { | 50 { |
| 52 return adoptRef(new IDBFactoryBackendImpl()); | 51 return adoptRef(new IDBFactoryBackendImpl()); |
| 53 } | 52 } |
| 54 virtual ~IDBFactoryBackendImpl(); | 53 virtual ~IDBFactoryBackendImpl(); |
| 55 | 54 |
| 56 // Notifications from weak pointers. | 55 // Notifications from weak pointers. |
| 57 virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier); | 56 virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier); |
| 58 | 57 |
| 59 virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityO
rigin>, ScriptExecutionContext*, const String& dataDir); | 58 virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, const String& databa
seIdentifier, ScriptExecutionContext*, const String& dataDir); |
| 60 virtual void open(const String& name, int64_t version, int64_t transactionId
, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, PassRefPtr<Securit
yOrigin>, ScriptExecutionContext*, const String& dataDir); | 59 virtual void open(const String& name, int64_t version, int64_t transactionId
, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const String& data
baseIdentifier, ScriptExecutionContext*, const String& dataDir); |
| 61 | 60 |
| 62 virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, Pa
ssRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir); | 61 virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, co
nst String& databaseIdentifier, ScriptExecutionContext*, const String& dataDir); |
| 63 | 62 |
| 64 protected: | 63 protected: |
| 65 IDBFactoryBackendImpl(); | 64 IDBFactoryBackendImpl(); |
| 66 virtual PassRefPtr<IDBBackingStore> openBackingStore(const String& databaseI
dentifier, const String& dataDir); | 65 virtual PassRefPtr<IDBBackingStore> openBackingStore(const String& databaseI
dentifier, const String& dataDir); |
| 67 | 66 |
| 68 private: | 67 private: |
| 69 typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendM
ap; | 68 typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendM
ap; |
| 70 IDBDatabaseBackendMap m_databaseBackendMap; | 69 IDBDatabaseBackendMap m_databaseBackendMap; |
| 71 | 70 |
| 72 typedef HashMap<String, WeakPtr<IDBBackingStore> > IDBBackingStoreMap; | 71 typedef HashMap<String, WeakPtr<IDBBackingStore> > IDBBackingStoreMap; |
| 73 IDBBackingStoreMap m_backingStoreMap; | 72 IDBBackingStoreMap m_backingStoreMap; |
| 74 | 73 |
| 75 HashSet<RefPtr<IDBBackingStore> > m_sessionOnlyBackingStores; | 74 HashSet<RefPtr<IDBBackingStore> > m_sessionOnlyBackingStores; |
| 76 | 75 |
| 77 // Only one instance of the factory should exist at any given time. | 76 // Only one instance of the factory should exist at any given time. |
| 78 static IDBFactoryBackendImpl* idbFactoryBackendImpl; | 77 static IDBFactoryBackendImpl* idbFactoryBackendImpl; |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace WebCore | 80 } // namespace WebCore |
| 82 | 81 |
| 83 #endif // IDBFactoryBackendImpl_h | 82 #endif // IDBFactoryBackendImpl_h |
| OLD | NEW |