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 <map> |
| 10 |
9 #include "base/id_map.h" | 11 #include "base/id_map.h" |
10 #include "base/nullable_string16.h" | 12 #include "base/nullable_string16.h" |
11 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" |
17 | 19 |
18 class IndexedDBKey; | 20 class IndexedDBKey; |
| 21 class RendererWebIDBCursorImpl; |
19 | 22 |
20 namespace WebKit { | 23 namespace WebKit { |
21 class WebDOMStringList; | 24 class WebDOMStringList; |
22 class WebFrame; | 25 class WebFrame; |
23 class WebIDBKeyRange; | 26 class WebIDBKeyRange; |
24 class WebIDBTransaction; | 27 class WebIDBTransaction; |
25 } | 28 } |
26 | 29 |
27 namespace content { | 30 namespace content { |
28 class SerializedScriptValue; | 31 class SerializedScriptValue; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 unsigned short direction, | 147 unsigned short direction, |
145 WebKit::WebIDBCallbacks* callbacks, | 148 WebKit::WebIDBCallbacks* callbacks, |
146 int32 idb_object_store_id, | 149 int32 idb_object_store_id, |
147 const WebKit::WebIDBTransaction& transaction, | 150 const WebKit::WebIDBTransaction& transaction, |
148 WebKit::WebExceptionCode* ec); | 151 WebKit::WebExceptionCode* ec); |
149 | 152 |
150 void RegisterWebIDBTransactionCallbacks( | 153 void RegisterWebIDBTransactionCallbacks( |
151 WebKit::WebIDBTransactionCallbacks* callbacks, | 154 WebKit::WebIDBTransactionCallbacks* callbacks, |
152 int32 id); | 155 int32 id); |
153 | 156 |
| 157 void CursorDestroyed(int32 cursor_id); |
| 158 |
154 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); | 159 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); |
155 | 160 |
156 private: | 161 private: |
157 // IDBCallback message handlers. | 162 // IDBCallback message handlers. |
158 void OnSuccessNull(int32 response_id); | 163 void OnSuccessNull(int32 response_id); |
159 void OnSuccessIDBDatabase(int32 response_id, int32 object_id); | 164 void OnSuccessIDBDatabase(int32 response_id, int32 object_id); |
160 void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key); | 165 void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key); |
161 void OnSuccessIDBTransaction(int32 response_id, int32 object_id); | 166 void OnSuccessIDBTransaction(int32 response_id, int32 object_id); |
162 void OnSuccessOpenCursor(int32 response_id, int32 object_id, | 167 void OnSuccessOpenCursor(int32 response_id, int32 object_id, |
163 const IndexedDBKey& key, | 168 const IndexedDBKey& key, |
164 const IndexedDBKey& primary_key, | 169 const IndexedDBKey& primary_key, |
165 const content::SerializedScriptValue& value); | 170 const content::SerializedScriptValue& value); |
| 171 void OnSuccessCursorContinue(int32 response_id, |
| 172 int32 cursor_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 cursor id to RendererWebIDBCursorImpl. |
| 196 std::map<int32, RendererWebIDBCursorImpl*> cursors_; |
| 197 |
185 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 198 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
186 }; | 199 }; |
187 | 200 |
188 #endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ | 201 #endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ |
OLD | NEW |