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 27 matching lines...) Expand all Loading... |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 class IDBBackingStore; | 40 class IDBBackingStore; |
41 class IDBDatabase; | 41 class IDBDatabase; |
42 class IDBFactoryBackendImpl; | 42 class IDBFactoryBackendImpl; |
43 class IDBObjectStoreBackendImpl; | 43 class IDBObjectStoreBackendImpl; |
44 class IDBTransactionCoordinator; | 44 class IDBTransactionCoordinator; |
45 | 45 |
46 class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface { | 46 class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface { |
47 public: | 47 public: |
48 static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, IDBBack
ingStore* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const St
ring& uniqueIdentifier); | 48 static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, IDBBack
ingStore* database, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImp
l* factory, const String& uniqueIdentifier) |
| 49 { |
| 50 return adoptRef(new IDBDatabaseBackendImpl(name, database, coordinator,
factory, uniqueIdentifier)); |
| 51 } |
49 virtual ~IDBDatabaseBackendImpl(); | 52 virtual ~IDBDatabaseBackendImpl(); |
50 | 53 |
51 PassRefPtr<IDBBackingStore> backingStore() const; | 54 PassRefPtr<IDBBackingStore> backingStore() const; |
52 | 55 |
53 static const int64_t InvalidId = 0; | 56 static const int64_t InvalidId = 0; |
54 int64_t id() const { return m_id; } | 57 int64_t id() const { return m_id; } |
55 | 58 |
56 // FIXME: Rename "open" to something more descriptive, like registerFrontEnd
Callbacks. | 59 // FIXME: Rename "open" to something more descriptive, like registerFrontEnd
Callbacks. |
57 void open(PassRefPtr<IDBDatabaseCallbacks>); | 60 void open(PassRefPtr<IDBDatabaseCallbacks>); |
58 void openConnection(PassRefPtr<IDBCallbacks>); | 61 void openConnection(PassRefPtr<IDBCallbacks>); |
(...skipping 10 matching lines...) Expand all Loading... |
69 virtual void close(PassRefPtr<IDBDatabaseCallbacks>); | 72 virtual void close(PassRefPtr<IDBDatabaseCallbacks>); |
70 | 73 |
71 PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name); | 74 PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name); |
72 IDBTransactionCoordinator* transactionCoordinator() const { return m_transac
tionCoordinator.get(); } | 75 IDBTransactionCoordinator* transactionCoordinator() const { return m_transac
tionCoordinator.get(); } |
73 void transactionStarted(PassRefPtr<IDBTransactionBackendInterface>); | 76 void transactionStarted(PassRefPtr<IDBTransactionBackendInterface>); |
74 void transactionFinished(PassRefPtr<IDBTransactionBackendInterface>); | 77 void transactionFinished(PassRefPtr<IDBTransactionBackendInterface>); |
75 | 78 |
76 private: | 79 private: |
77 IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBTra
nsactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier); | 80 IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBTra
nsactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier); |
78 | 81 |
79 bool openInternal(); | 82 void openInternal(); |
80 void loadObjectStores(); | 83 void loadObjectStores(); |
81 void processPendingCalls(); | 84 void processPendingCalls(); |
82 | 85 |
83 static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<ID
BDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTran
sactionBackendInterface>); | 86 static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<ID
BDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTran
sactionBackendInterface>); |
84 static void deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<ID
BDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTran
sactionBackendInterface>); | 87 static void deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<ID
BDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTran
sactionBackendInterface>); |
85 static void setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDataba
seBackendImpl>, const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBT
ransactionBackendInterface>); | 88 static void setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDataba
seBackendImpl>, const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBT
ransactionBackendInterface>); |
86 | 89 |
87 // These are used as setVersion transaction abort tasks. | 90 // These are used as setVersion transaction abort tasks. |
88 static void removeObjectStoreFromMap(ScriptExecutionContext*, PassRefPtr<IDB
DatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>); | 91 static void removeObjectStoreFromMap(ScriptExecutionContext*, PassRefPtr<IDB
DatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>); |
89 static void addObjectStoreToMap(ScriptExecutionContext*, PassRefPtr<IDBDatab
aseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>); | 92 static void addObjectStoreToMap(ScriptExecutionContext*, PassRefPtr<IDBDatab
aseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>); |
(...skipping 25 matching lines...) Expand all Loading... |
115 | 118 |
116 typedef ListHashSet<RefPtr<IDBDatabaseCallbacks> > DatabaseCallbacksSet; | 119 typedef ListHashSet<RefPtr<IDBDatabaseCallbacks> > DatabaseCallbacksSet; |
117 DatabaseCallbacksSet m_databaseCallbacksSet; | 120 DatabaseCallbacksSet m_databaseCallbacksSet; |
118 }; | 121 }; |
119 | 122 |
120 } // namespace WebCore | 123 } // namespace WebCore |
121 | 124 |
122 #endif | 125 #endif |
123 | 126 |
124 #endif // IDBDatabaseBackendImpl_h | 127 #endif // IDBDatabaseBackendImpl_h |
OLD | NEW |