OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 25 matching lines...) Expand all Loading... |
36 #include "modules/indexeddb/IDBCallbacks.h" | 36 #include "modules/indexeddb/IDBCallbacks.h" |
37 #include "modules/indexeddb/IDBDatabaseCallbacks.h" | 37 #include "modules/indexeddb/IDBDatabaseCallbacks.h" |
38 #include "modules/indexeddb/IDBKeyRange.h" | 38 #include "modules/indexeddb/IDBKeyRange.h" |
39 #include "modules/indexeddb/IDBMetadata.h" | 39 #include "modules/indexeddb/IDBMetadata.h" |
40 #include "public/WebData.h" | 40 #include "public/WebData.h" |
41 | 41 |
42 using namespace WebCore; | 42 using namespace WebCore; |
43 | 43 |
44 namespace WebKit { | 44 namespace WebKit { |
45 | 45 |
46 PassRefPtr<IDBDatabaseBackendInterface> IDBDatabaseBackendProxy::create(PassOwnP
tr<WebIDBDatabase> database) | 46 IDBDatabaseBackendInterface* IDBDatabaseBackendProxy::create(PassOwnPtr<WebIDBDa
tabase> database) |
47 { | 47 { |
48 return adoptRef(new IDBDatabaseBackendProxy(database)); | 48 return new IDBDatabaseBackendProxy(database); |
49 } | 49 } |
50 | 50 |
51 IDBDatabaseBackendProxy::IDBDatabaseBackendProxy(PassOwnPtr<WebIDBDatabase> data
base) | 51 IDBDatabaseBackendProxy::IDBDatabaseBackendProxy(PassOwnPtr<WebIDBDatabase> data
base) |
52 : m_webIDBDatabase(database) | 52 : m_webIDBDatabase(database) |
53 { | 53 { |
54 } | 54 } |
55 | 55 |
56 IDBDatabaseBackendProxy::~IDBDatabaseBackendProxy() | 56 IDBDatabaseBackendProxy::~IDBDatabaseBackendProxy() |
57 { | 57 { |
58 } | 58 } |
59 | 59 |
60 void IDBDatabaseBackendProxy::createObjectStore(int64_t transactionId, int64_t o
bjectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement) | 60 void IDBDatabaseBackendProxy::createObjectStore(int64_t transactionId, int64_t o
bjectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement) |
61 { | 61 { |
62 if (m_webIDBDatabase) | 62 if (m_webIDBDatabase) |
63 m_webIDBDatabase->createObjectStore(transactionId, objectStoreId, name,
keyPath, autoIncrement); | 63 m_webIDBDatabase->createObjectStore(transactionId, objectStoreId, name,
keyPath, autoIncrement); |
64 } | 64 } |
65 | 65 |
66 void IDBDatabaseBackendProxy::deleteObjectStore(int64_t transactionId, int64_t o
bjectStoreId) | 66 void IDBDatabaseBackendProxy::deleteObjectStore(int64_t transactionId, int64_t o
bjectStoreId) |
67 { | 67 { |
68 if (m_webIDBDatabase) | 68 if (m_webIDBDatabase) |
69 m_webIDBDatabase->deleteObjectStore(transactionId, objectStoreId); | 69 m_webIDBDatabase->deleteObjectStore(transactionId, objectStoreId); |
70 } | 70 } |
71 | 71 |
72 void IDBDatabaseBackendProxy::createTransaction(int64_t id, PassRefPtr<IDBDataba
seCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, unsigned short mo
de) | 72 void IDBDatabaseBackendProxy::createTransaction(int64_t id, IDBDatabaseCallbacks
* callbacks, const Vector<int64_t>& objectStoreIds, unsigned short mode) |
73 { | 73 { |
74 m_webIDBDatabase->createTransaction(id, new WebIDBDatabaseCallbacksImpl(call
backs), objectStoreIds, mode); | 74 m_webIDBDatabase->createTransaction(id, new WebIDBDatabaseCallbacksImpl(call
backs), objectStoreIds, mode); |
75 } | 75 } |
76 | 76 |
77 void IDBDatabaseBackendProxy::commit(int64_t transactionId) | 77 void IDBDatabaseBackendProxy::commit(int64_t transactionId) |
78 { | 78 { |
79 m_webIDBDatabase->commit(transactionId); | 79 m_webIDBDatabase->commit(transactionId); |
80 } | 80 } |
81 | 81 |
82 void IDBDatabaseBackendProxy::abort(int64_t transactionId) | 82 void IDBDatabaseBackendProxy::abort(int64_t transactionId) |
83 { | 83 { |
84 m_webIDBDatabase->abort(transactionId); | 84 m_webIDBDatabase->abort(transactionId); |
85 } | 85 } |
86 | 86 |
87 void IDBDatabaseBackendProxy::abort(int64_t transactionId, PassRefPtr<IDBDatabas
eError> error) | 87 void IDBDatabaseBackendProxy::abort(int64_t transactionId, PassRefPtr<IDBDatabas
eError> error) |
88 { | 88 { |
89 m_webIDBDatabase->abort(transactionId, error); | 89 m_webIDBDatabase->abort(transactionId, error); |
90 } | 90 } |
91 | 91 |
92 void IDBDatabaseBackendProxy::openCursor(int64_t transactionId, int64_t objectSt
oreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirec
tion direction, bool keyOnly, TaskType taskType, PassRefPtr<IDBCallbacks> callba
cks) | 92 void IDBDatabaseBackendProxy::openCursor(int64_t transactionId, int64_t objectSt
oreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirec
tion direction, bool keyOnly, TaskType taskType, IDBCallbacks* callbacks) |
93 { | 93 { |
94 m_webIDBDatabase->openCursor(transactionId, objectStoreId, indexId, keyRange
, static_cast<WebIDBCursor::Direction>(direction), keyOnly, static_cast<WebIDBDa
tabase::TaskType>(taskType), new WebIDBCallbacksImpl(callbacks)); | 94 m_webIDBDatabase->openCursor(transactionId, objectStoreId, indexId, keyRange
, static_cast<WebIDBCursor::Direction>(direction), keyOnly, static_cast<WebIDBDa
tabase::TaskType>(taskType), new WebIDBCallbacksImpl(callbacks)); |
95 } | 95 } |
96 | 96 |
97 void IDBDatabaseBackendProxy::count(int64_t transactionId, int64_t objectStoreId
, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> ca
llbacks) | 97 void IDBDatabaseBackendProxy::count(int64_t transactionId, int64_t objectStoreId
, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IDBCallbacks* callbacks) |
98 { | 98 { |
99 if (m_webIDBDatabase) | 99 if (m_webIDBDatabase) |
100 m_webIDBDatabase->count(transactionId, objectStoreId, indexId, keyRange,
new WebIDBCallbacksImpl(callbacks)); | 100 m_webIDBDatabase->count(transactionId, objectStoreId, indexId, keyRange,
new WebIDBCallbacksImpl(callbacks)); |
101 } | 101 } |
102 | 102 |
103 void IDBDatabaseBackendProxy::get(int64_t transactionId, int64_t objectStoreId,
int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBC
allbacks> callbacks) | 103 void IDBDatabaseBackendProxy::get(int64_t transactionId, int64_t objectStoreId,
int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, IDBCallbacks* c
allbacks) |
104 { | 104 { |
105 if (m_webIDBDatabase) | 105 if (m_webIDBDatabase) |
106 m_webIDBDatabase->get(transactionId, objectStoreId, indexId, keyRange, k
eyOnly, new WebIDBCallbacksImpl(callbacks)); | 106 m_webIDBDatabase->get(transactionId, objectStoreId, indexId, keyRange, k
eyOnly, new WebIDBCallbacksImpl(callbacks)); |
107 } | 107 } |
108 | 108 |
109 void IDBDatabaseBackendProxy::put(int64_t transactionId, int64_t objectStoreId,
PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRef
Ptr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<Index
Keys>& indexKeys) | 109 void IDBDatabaseBackendProxy::put(int64_t transactionId, int64_t objectStoreId,
PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, PutMode putMode, IDBCall
backs* callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& inde
xKeys) |
110 { | 110 { |
111 if (m_webIDBDatabase) { | 111 if (m_webIDBDatabase) { |
112 m_webIDBDatabase->put(transactionId, objectStoreId, WebData(value), key,
static_cast<WebIDBDatabase::PutMode>(putMode), new WebIDBCallbacksImpl(callback
s), indexIds, indexKeys); | 112 m_webIDBDatabase->put(transactionId, objectStoreId, WebData(value), key,
static_cast<WebIDBDatabase::PutMode>(putMode), new WebIDBCallbacksImpl(callback
s), indexIds, indexKeys); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 void IDBDatabaseBackendProxy::setIndexKeys(int64_t transactionId, int64_t object
StoreId, PassRefPtr<IDBKey> primaryKey, const Vector<int64_t>& indexIds, const V
ector<IndexKeys>& indexKeys) | 116 void IDBDatabaseBackendProxy::setIndexKeys(int64_t transactionId, int64_t object
StoreId, PassRefPtr<IDBKey> primaryKey, const Vector<int64_t>& indexIds, const V
ector<IndexKeys>& indexKeys) |
117 { | 117 { |
118 if (m_webIDBDatabase) | 118 if (m_webIDBDatabase) |
119 m_webIDBDatabase->setIndexKeys(transactionId, objectStoreId, primaryKey,
indexIds, indexKeys); | 119 m_webIDBDatabase->setIndexKeys(transactionId, objectStoreId, primaryKey,
indexIds, indexKeys); |
120 } | 120 } |
121 | 121 |
122 void IDBDatabaseBackendProxy::setIndexesReady(int64_t transactionId, int64_t obj
ectStoreId, const Vector<int64_t>& indexIds) | 122 void IDBDatabaseBackendProxy::setIndexesReady(int64_t transactionId, int64_t obj
ectStoreId, const Vector<int64_t>& indexIds) |
123 { | 123 { |
124 if (m_webIDBDatabase) | 124 if (m_webIDBDatabase) |
125 m_webIDBDatabase->setIndexesReady(transactionId, objectStoreId, indexIds
); | 125 m_webIDBDatabase->setIndexesReady(transactionId, objectStoreId, indexIds
); |
126 } | 126 } |
127 | 127 |
128 void IDBDatabaseBackendProxy::deleteRange(int64_t transactionId, int64_t objectS
toreId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks) | 128 void IDBDatabaseBackendProxy::deleteRange(int64_t transactionId, int64_t objectS
toreId, PassRefPtr<IDBKeyRange> keyRange, IDBCallbacks* callbacks) |
129 { | 129 { |
130 if (m_webIDBDatabase) | 130 if (m_webIDBDatabase) |
131 m_webIDBDatabase->deleteRange(transactionId, objectStoreId, keyRange, ne
w WebIDBCallbacksImpl(callbacks)); | 131 m_webIDBDatabase->deleteRange(transactionId, objectStoreId, keyRange, ne
w WebIDBCallbacksImpl(callbacks)); |
132 } | 132 } |
133 | 133 |
134 void IDBDatabaseBackendProxy::clear(int64_t transactionId, int64_t objectStoreId
, PassRefPtr<IDBCallbacks> callbacks) | 134 void IDBDatabaseBackendProxy::clear(int64_t transactionId, int64_t objectStoreId
, IDBCallbacks* callbacks) |
135 { | 135 { |
136 if (m_webIDBDatabase) | 136 if (m_webIDBDatabase) |
137 m_webIDBDatabase->clear(transactionId, objectStoreId, new WebIDBCallback
sImpl(callbacks)); | 137 m_webIDBDatabase->clear(transactionId, objectStoreId, new WebIDBCallback
sImpl(callbacks)); |
138 } | 138 } |
139 | 139 |
140 void IDBDatabaseBackendProxy::createIndex(int64_t transactionId, int64_t objectS
toreId, int64_t indexId, const String& name, const WebCore::IDBKeyPath& keyPath,
bool unique, bool multiEntry) | 140 void IDBDatabaseBackendProxy::createIndex(int64_t transactionId, int64_t objectS
toreId, int64_t indexId, const String& name, const WebCore::IDBKeyPath& keyPath,
bool unique, bool multiEntry) |
141 { | 141 { |
142 if (m_webIDBDatabase) | 142 if (m_webIDBDatabase) |
143 m_webIDBDatabase->createIndex(transactionId, objectStoreId, indexId, nam
e, keyPath, unique, multiEntry); | 143 m_webIDBDatabase->createIndex(transactionId, objectStoreId, indexId, nam
e, keyPath, unique, multiEntry); |
144 } | 144 } |
145 | 145 |
146 void IDBDatabaseBackendProxy::deleteIndex(int64_t transactionId, int64_t objectS
toreId, int64_t indexId) | 146 void IDBDatabaseBackendProxy::deleteIndex(int64_t transactionId, int64_t objectS
toreId, int64_t indexId) |
147 { | 147 { |
148 if (m_webIDBDatabase) | 148 if (m_webIDBDatabase) |
149 m_webIDBDatabase->deleteIndex(transactionId, objectStoreId, indexId); | 149 m_webIDBDatabase->deleteIndex(transactionId, objectStoreId, indexId); |
150 } | 150 } |
151 | 151 |
152 void IDBDatabaseBackendProxy::close(PassRefPtr<IDBDatabaseCallbacks>) | 152 void IDBDatabaseBackendProxy::close(IDBDatabaseCallbacks*) |
153 { | 153 { |
154 m_webIDBDatabase->close(); | 154 m_webIDBDatabase->close(); |
155 } | 155 } |
156 | 156 |
157 } // namespace WebKit | 157 } // namespace WebKit |
OLD | NEW |