OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
10 #include "base/nullable_string16.h" | 10 #include "base/nullable_string16.h" |
11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall backs.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall backs.h" |
17 #include <map> | |
17 | 18 |
18 class IndexedDBKey; | 19 class IndexedDBKey; |
19 | 20 |
20 namespace WebKit { | 21 namespace WebKit { |
21 class WebDOMStringList; | 22 class WebDOMStringList; |
22 class WebFrame; | 23 class WebFrame; |
23 class WebIDBKeyRange; | 24 class WebIDBKeyRange; |
24 class WebIDBTransaction; | 25 class WebIDBTransaction; |
25 } | 26 } |
26 | 27 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 int32 idb_object_store_id, | 147 int32 idb_object_store_id, |
147 const WebKit::WebIDBTransaction& transaction, | 148 const WebKit::WebIDBTransaction& transaction, |
148 WebKit::WebExceptionCode* ec); | 149 WebKit::WebExceptionCode* ec); |
149 | 150 |
150 void RegisterWebIDBTransactionCallbacks( | 151 void RegisterWebIDBTransactionCallbacks( |
151 WebKit::WebIDBTransactionCallbacks* callbacks, | 152 WebKit::WebIDBTransactionCallbacks* callbacks, |
152 int32 id); | 153 int32 id); |
153 | 154 |
154 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); | 155 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); |
155 | 156 |
157 IndexedDBKey getCursorKey(int32 cursor_id); | |
158 IndexedDBKey getCursorPrimaryKey(int32 cursor_id); | |
159 content::SerializedScriptValue getCursorValue(int32 cursor_id); | |
160 void CursorDestroyed(int32 cursor_id); | |
161 | |
156 private: | 162 private: |
157 // IDBCallback message handlers. | 163 // IDBCallback message handlers. |
158 void OnSuccessNull(int32 response_id); | 164 void OnSuccessNull(int32 response_id); |
159 void OnSuccessIDBDatabase(int32 response_id, int32 object_id); | 165 void OnSuccessIDBDatabase(int32 response_id, int32 object_id); |
160 void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key); | 166 void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key); |
161 void OnSuccessIDBTransaction(int32 response_id, int32 object_id); | 167 void OnSuccessIDBTransaction(int32 response_id, int32 object_id); |
162 void OnSuccessOpenCursor(int32 response_id, int32 object_id, | 168 void OnSuccessOpenCursor(int32 response_id, int32 object_id, |
163 const IndexedDBKey& key, | 169 const IndexedDBKey& key, |
164 const IndexedDBKey& primary_key, | 170 const IndexedDBKey& primary_key, |
165 const content::SerializedScriptValue& value); | 171 const content::SerializedScriptValue& value); |
172 void OnSuccessCursorContinue(int32 response_id, | |
173 const IndexedDBKey& key, | |
174 const IndexedDBKey& primary_key, | |
175 const content::SerializedScriptValue& value); | |
166 void OnSuccessStringList(int32 response_id, | 176 void OnSuccessStringList(int32 response_id, |
167 const std::vector<string16>& value); | 177 const std::vector<string16>& value); |
168 void OnSuccessSerializedScriptValue( | 178 void OnSuccessSerializedScriptValue( |
169 int32 response_id, | 179 int32 response_id, |
170 const content::SerializedScriptValue& value); | 180 const content::SerializedScriptValue& value); |
171 void OnError(int32 response_id, int code, const string16& message); | 181 void OnError(int32 response_id, int code, const string16& message); |
172 void OnBlocked(int32 response_id); | 182 void OnBlocked(int32 response_id); |
173 void OnAbort(int32 transaction_id); | 183 void OnAbort(int32 transaction_id); |
174 void OnComplete(int32 transaction_id); | 184 void OnComplete(int32 transaction_id); |
175 void OnVersionChange(int32 database_id, const string16& newVersion); | 185 void OnVersionChange(int32 database_id, const string16& newVersion); |
176 | 186 |
177 // Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be | 187 // Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be |
178 // destroyed and used on the same thread it was created on. | 188 // destroyed and used on the same thread it was created on. |
179 IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer> pending_callbacks_; | 189 IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer> pending_callbacks_; |
180 IDMap<WebKit::WebIDBTransactionCallbacks, IDMapOwnPointer> | 190 IDMap<WebKit::WebIDBTransactionCallbacks, IDMapOwnPointer> |
181 pending_transaction_callbacks_; | 191 pending_transaction_callbacks_; |
182 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> | 192 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> |
183 pending_database_callbacks_; | 193 pending_database_callbacks_; |
184 | 194 |
195 // Map from response id to cursor id. | |
196 std::map<int32,int32> pending_cursor_continues_; | |
197 | |
198 // FIXME: Double check these are only used on WebKit thread. | |
dgrogan
2011/10/29 00:54:28
You could use IDMap and AddWithID. IDMap ensures
hans
2011/10/31 16:11:52
OK, thanks.
| |
199 std::map<int32, IndexedDBKey> cursor_key_; // Map from cursor id to key. | |
200 std::map<int32, IndexedDBKey> cursor_primary_key_; | |
201 std::map<int32, content::SerializedScriptValue> cursor_value_; | |
202 | |
185 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 203 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
186 }; | 204 }; |
187 | 205 |
188 #endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ | 206 #endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ |
OLD | NEW |