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 12 matching lines...) Expand all Loading... |
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 WebIDBDatabase_h | 26 #ifndef WebIDBDatabase_h |
27 #define WebIDBDatabase_h | 27 #define WebIDBDatabase_h |
28 | 28 |
29 #include "WebBlobInfo.h" | 29 #include "WebBlobInfo.h" |
30 #include "WebCommon.h" | 30 #include "WebCommon.h" |
31 #include "WebIDBCursor.h" | 31 #include "WebIDBCursor.h" |
32 #include "WebIDBMetadata.h" | 32 #include "WebIDBMetadata.h" |
| 33 #include "public/platform/WebIDBTypes.h" |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 class WebData; | 37 class WebData; |
37 class WebIDBCallbacks; | 38 class WebIDBCallbacks; |
38 class WebIDBDatabaseCallbacks; | 39 class WebIDBDatabaseCallbacks; |
39 class WebIDBDatabaseError; | 40 class WebIDBDatabaseError; |
40 class WebIDBKey; | 41 class WebIDBKey; |
41 class WebIDBKeyPath; | 42 class WebIDBKeyPath; |
42 class WebIDBKeyRange; | 43 class WebIDBKeyRange; |
43 | 44 |
44 // See comment in WebIDBFactory for a high level overview of these classes. | 45 // See comment in WebIDBFactory for a high level overview of these classes. |
45 class WebIDBDatabase { | 46 class WebIDBDatabase { |
46 public: | 47 public: |
47 virtual ~WebIDBDatabase() { } | 48 virtual ~WebIDBDatabase() { } |
48 | 49 |
49 enum TransactionMode { | |
50 TransactionReadOnly = 0, | |
51 TransactionReadWrite, | |
52 TransactionVersionChange, | |
53 }; | |
54 | |
55 virtual void createObjectStore(long long transactionId, long long objectStor
eId, const WebString& name, const WebIDBKeyPath&, bool autoIncrement) { BLINK_AS
SERT_NOT_REACHED(); } | 50 virtual void createObjectStore(long long transactionId, long long objectStor
eId, const WebString& name, const WebIDBKeyPath&, bool autoIncrement) { BLINK_AS
SERT_NOT_REACHED(); } |
56 virtual void deleteObjectStore(long long transactionId, long long objectStor
eId) { BLINK_ASSERT_NOT_REACHED(); } | 51 virtual void deleteObjectStore(long long transactionId, long long objectStor
eId) { BLINK_ASSERT_NOT_REACHED(); } |
57 virtual void createTransaction(long long id, WebIDBDatabaseCallbacks*, const
WebVector<long long>& scope, TransactionMode) { BLINK_ASSERT_NOT_REACHED(); } | 52 virtual void createTransaction(long long id, WebIDBDatabaseCallbacks*, const
WebVector<long long>& scope, blink::TransactionMode) { BLINK_ASSERT_NOT_REACHED
(); } |
58 virtual void close() { BLINK_ASSERT_NOT_REACHED(); } | 53 virtual void close() { BLINK_ASSERT_NOT_REACHED(); } |
59 virtual void forceClose() { BLINK_ASSERT_NOT_REACHED(); } | 54 virtual void forceClose() { BLINK_ASSERT_NOT_REACHED(); } |
60 | 55 |
61 virtual void abort(long long transactionId) { BLINK_ASSERT_NOT_REACHED(); } | 56 virtual void abort(long long transactionId) { BLINK_ASSERT_NOT_REACHED(); } |
62 virtual void commit(long long transactionId) { BLINK_ASSERT_NOT_REACHED(); } | 57 virtual void commit(long long transactionId) { BLINK_ASSERT_NOT_REACHED(); } |
63 | 58 |
64 virtual void createIndex(long long transactionId, long long objectStoreId, l
ong long indexId, const WebString& name, const WebIDBKeyPath&, bool unique, bool
multiEntry) { BLINK_ASSERT_NOT_REACHED(); } | 59 virtual void createIndex(long long transactionId, long long objectStoreId, l
ong long indexId, const WebString& name, const WebIDBKeyPath&, bool unique, bool
multiEntry) { BLINK_ASSERT_NOT_REACHED(); } |
65 virtual void deleteIndex(long long transactionId, long long objectStoreId, l
ong long indexId) { BLINK_ASSERT_NOT_REACHED(); } | 60 virtual void deleteIndex(long long transactionId, long long objectStoreId, l
ong long indexId) { BLINK_ASSERT_NOT_REACHED(); } |
66 | 61 |
67 enum TaskType { | |
68 NormalTask = 0, | |
69 PreemptiveTask, | |
70 TaskTypeLast = PreemptiveTask | |
71 }; | |
72 | |
73 enum PutMode { | |
74 AddOrUpdate, | |
75 AddOnly, | |
76 CursorUpdate, | |
77 PutModeLast = CursorUpdate | |
78 }; | |
79 | |
80 static const long long minimumIndexId = 30; | 62 static const long long minimumIndexId = 30; |
81 | 63 |
82 typedef WebVector<WebIDBKey> WebIndexKeys; | 64 typedef WebVector<WebIDBKey> WebIndexKeys; |
83 | 65 |
84 virtual void get(long long transactionId, long long objectStoreId, long long
indexId, const WebIDBKeyRange&, bool keyOnly, WebIDBCallbacks*) { BLINK_ASSERT_
NOT_REACHED(); } | 66 virtual void get(long long transactionId, long long objectStoreId, long long
indexId, const WebIDBKeyRange&, bool keyOnly, WebIDBCallbacks*) { BLINK_ASSERT_
NOT_REACHED(); } |
85 virtual void put(long long transactionId, long long objectStoreId, const Web
Data& value, const WebVector<WebBlobInfo>&, const WebIDBKey&, PutMode, WebIDBCal
lbacks*, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) {
BLINK_ASSERT_NOT_REACHED(); } | 67 virtual void put(long long transactionId, long long objectStoreId, const Web
Data& value, const WebVector<WebBlobInfo>&, const WebIDBKey&, blink::PutMode, We
bIDBCallbacks*, const WebVector<long long>& indexIds, const WebVector<WebIndexKe
ys>&) { BLINK_ASSERT_NOT_REACHED(); } |
86 virtual void setIndexKeys(long long transactionId, long long objectStoreId,
const WebIDBKey&, const WebVector<long long>& indexIds, const WebVector<WebIndex
Keys>&) { BLINK_ASSERT_NOT_REACHED(); } | 68 virtual void setIndexKeys(long long transactionId, long long objectStoreId,
const WebIDBKey&, const WebVector<long long>& indexIds, const WebVector<WebIndex
Keys>&) { BLINK_ASSERT_NOT_REACHED(); } |
87 virtual void setIndexesReady(long long transactionId, long long objectStoreI
d, const WebVector<long long>& indexIds) { BLINK_ASSERT_NOT_REACHED(); } | 69 virtual void setIndexesReady(long long transactionId, long long objectStoreI
d, const WebVector<long long>& indexIds) { BLINK_ASSERT_NOT_REACHED(); } |
88 virtual void openCursor(long long transactionId, long long objectStoreId, lo
ng long indexId, const WebIDBKeyRange&, WebIDBCursor::Direction, bool keyOnly, T
askType, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } | 70 virtual void openCursor(long long transactionId, long long objectStoreId, lo
ng long indexId, const WebIDBKeyRange&, Direction, bool keyOnly, blink::TaskType
, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } |
89 virtual void count(long long transactionId, long long objectStoreId, long lo
ng indexId, const WebIDBKeyRange&, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(
); } | 71 virtual void count(long long transactionId, long long objectStoreId, long lo
ng indexId, const WebIDBKeyRange&, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(
); } |
90 virtual void deleteRange(long long transactionId, long long objectStoreId, c
onst WebIDBKeyRange&, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } | 72 virtual void deleteRange(long long transactionId, long long objectStoreId, c
onst WebIDBKeyRange&, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } |
91 virtual void clear(long long transactionId, long long objectStoreId, WebIDBC
allbacks*) { BLINK_ASSERT_NOT_REACHED(); } | 73 virtual void clear(long long transactionId, long long objectStoreId, WebIDBC
allbacks*) { BLINK_ASSERT_NOT_REACHED(); } |
92 virtual void ackReceivedBlobs(const WebVector<WebString>& uuids) { BLINK_ASS
ERT_NOT_REACHED(); } | 74 virtual void ackReceivedBlobs(const WebVector<WebString>& uuids) { BLINK_ASS
ERT_NOT_REACHED(); } |
93 | 75 |
94 protected: | 76 protected: |
95 WebIDBDatabase() { } | 77 WebIDBDatabase() { } |
96 }; | 78 }; |
97 | 79 |
98 } // namespace blink | 80 } // namespace blink |
99 | 81 |
100 #endif // WebIDBDatabase_h | 82 #endif // WebIDBDatabase_h |
OLD | NEW |