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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef IDBDatabaseBackendInterface_h | 26 #ifndef IDBDatabaseBackendInterface_h |
27 #define IDBDatabaseBackendInterface_h | 27 #define IDBDatabaseBackendInterface_h |
28 | 28 |
| 29 #include "heap/Handle.h" |
29 #include "modules/indexeddb/IDBDatabaseError.h" | 30 #include "modules/indexeddb/IDBDatabaseError.h" |
30 #include "modules/indexeddb/IndexedDB.h" | 31 #include "modules/indexeddb/IndexedDB.h" |
31 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
32 #include "wtf/RefCounted.h" | 33 #include "wtf/RefCounted.h" |
33 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
34 | 35 |
35 namespace WebCore { | 36 namespace WebCore { |
36 | 37 |
37 class IDBCallbacks; | 38 class IDBCallbacks; |
38 class IDBDatabaseCallbacks; | 39 class IDBDatabaseCallbacks; |
39 class IDBKey; | 40 class IDBKey; |
40 class IDBKeyPath; | 41 class IDBKeyPath; |
41 class IDBKeyRange; | 42 class IDBKeyRange; |
42 struct IDBDatabaseMetadata; | 43 struct IDBDatabaseMetadata; |
43 class SharedBuffer; | 44 class SharedBuffer; |
44 | 45 |
45 typedef int ExceptionCode; | 46 typedef int ExceptionCode; |
46 | 47 |
47 // This is implemented by IDBDatabaseBackendImpl and optionally others (in order
to proxy | 48 // This is implemented by IDBDatabaseBackendImpl and optionally others (in order
to proxy |
48 // calls across process barriers). All calls to these classes should be non-bloc
king and | 49 // calls across process barriers). All calls to these classes should be non-bloc
king and |
49 // trigger work on a background thread if necessary. | 50 // trigger work on a background thread if necessary. |
50 class IDBDatabaseBackendInterface : public RefCounted<IDBDatabaseBackendInterfac
e> { | 51 class IDBDatabaseBackendInterface : public HeapAllocatedFinalized<IDBDatabaseBac
kendInterface> { |
| 52 DECLARE_GC_INFO |
51 public: | 53 public: |
52 virtual ~IDBDatabaseBackendInterface() { } | 54 virtual ~IDBDatabaseBackendInterface() { } |
53 | 55 |
54 virtual void createObjectStore(int64_t transactionId, int64_t objectStoreId,
const String& name, const IDBKeyPath&, bool autoIncrement) = 0; | 56 virtual void createObjectStore(int64_t transactionId, int64_t objectStoreId,
const String& name, const IDBKeyPath&, bool autoIncrement) = 0; |
55 virtual void deleteObjectStore(int64_t transactionId, int64_t objectStoreId)
= 0; | 57 virtual void deleteObjectStore(int64_t transactionId, int64_t objectStoreId)
= 0; |
56 virtual void createTransaction(int64_t transactionId, PassRefPtr<IDBDatabase
Callbacks>, const Vector<int64_t>& objectStoreIds, unsigned short mode) = 0; | 58 virtual void createTransaction(int64_t transactionId, IDBDatabaseCallbacks*,
const Vector<int64_t>& objectStoreIds, unsigned short mode) = 0; |
57 virtual void close(PassRefPtr<IDBDatabaseCallbacks>) = 0; | 59 virtual void close(IDBDatabaseCallbacks*) = 0; |
58 | 60 |
59 // Transaction-specific operations. | 61 // Transaction-specific operations. |
60 virtual void commit(int64_t transactionId) = 0; | 62 virtual void commit(int64_t transactionId) = 0; |
61 virtual void abort(int64_t transactionId) = 0; | 63 virtual void abort(int64_t transactionId) = 0; |
62 virtual void abort(int64_t transactionId, PassRefPtr<IDBDatabaseError>) = 0; | 64 virtual void abort(int64_t transactionId, PassRefPtr<IDBDatabaseError>) = 0; |
63 | 65 |
64 virtual void createIndex(int64_t transactionId, int64_t objectStoreId, int64
_t indexId, const String& name, const IDBKeyPath&, bool unique, bool multiEntry)
= 0; | 66 virtual void createIndex(int64_t transactionId, int64_t objectStoreId, int64
_t indexId, const String& name, const IDBKeyPath&, bool unique, bool multiEntry)
= 0; |
65 virtual void deleteIndex(int64_t transactionId, int64_t objectStoreId, int64
_t indexId) = 0; | 67 virtual void deleteIndex(int64_t transactionId, int64_t objectStoreId, int64
_t indexId) = 0; |
66 | 68 |
67 enum TaskType { | 69 enum TaskType { |
68 NormalTask = 0, | 70 NormalTask = 0, |
69 PreemptiveTask | 71 PreemptiveTask |
70 }; | 72 }; |
71 | 73 |
72 enum PutMode { | 74 enum PutMode { |
73 AddOrUpdate, | 75 AddOrUpdate, |
74 AddOnly, | 76 AddOnly, |
75 CursorUpdate | 77 CursorUpdate |
76 }; | 78 }; |
77 | 79 |
78 static const int64_t MinimumIndexId = 30; | 80 static const int64_t MinimumIndexId = 30; |
79 | 81 |
80 typedef Vector<RefPtr<IDBKey> > IndexKeys; | 82 typedef Vector<RefPtr<IDBKey> > IndexKeys; |
81 | 83 |
82 virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t index
Id, PassRefPtr<IDBKeyRange>, bool keyOnly, PassRefPtr<IDBCallbacks>) = 0; | 84 virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t index
Id, PassRefPtr<IDBKeyRange>, bool keyOnly, IDBCallbacks*) = 0; |
83 // Note that 'value' may be consumed/adopted by this call. | 85 // Note that 'value' may be consumed/adopted by this call. |
84 virtual void put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<Sh
aredBuffer> value, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, const
Vector<int64_t>& indexIds, const Vector<IndexKeys>&) = 0; | 86 virtual void put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<Sh
aredBuffer> value, PassRefPtr<IDBKey>, PutMode, IDBCallbacks*, const Vector<int6
4_t>& indexIds, const Vector<IndexKeys>&) = 0; |
85 virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, Pass
RefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<Inde
xKeys>&) = 0; | 87 virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, Pass
RefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<Inde
xKeys>&) = 0; |
86 virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, c
onst Vector<int64_t>& indexIds) = 0; | 88 virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, c
onst Vector<int64_t>& indexIds) = 0; |
87 virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_
t indexId, PassRefPtr<IDBKeyRange>, IndexedDB::CursorDirection, bool keyOnly, Ta
skType, PassRefPtr<IDBCallbacks>) = 0; | 89 virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_
t indexId, PassRefPtr<IDBKeyRange>, IndexedDB::CursorDirection, bool keyOnly, Ta
skType, IDBCallbacks*) = 0; |
88 virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t ind
exId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0; | 90 virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t ind
exId, PassRefPtr<IDBKeyRange>, IDBCallbacks*) = 0; |
89 virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassR
efPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0; | 91 virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassR
efPtr<IDBKeyRange>, IDBCallbacks*) = 0; |
90 virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<
IDBCallbacks>) = 0; | 92 virtual void clear(int64_t transactionId, int64_t objectStoreId, IDBCallback
s*) = 0; |
| 93 |
| 94 virtual void trace(Visitor*) = 0; |
91 }; | 95 }; |
92 | 96 |
93 } // namespace WebCore | 97 } // namespace WebCore |
94 | 98 |
95 #endif // IDBDatabaseBackendInterface_h | 99 #endif // IDBDatabaseBackendInterface_h |
OLD | NEW |