Chromium Code Reviews| 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> | |
|
michaeln
2011/11/03 18:10:04
we generally like to put std includes up top follo
hans
2011/11/04 10:09:44
Done.
| |
| 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 |
| 27 namespace content { | 28 namespace content { |
| 28 class SerializedScriptValue; | 29 class SerializedScriptValue; |
| 29 } | 30 } |
| 30 | 31 |
| 32 class RendererWebIDBCursorImpl; | |
|
michaeln
2011/11/03 18:10:04
nit: this forward should be up by class IndexedDBK
hans
2011/11/04 10:09:44
Done.
| |
| 33 | |
| 31 // Handle the indexed db related communication for this entire renderer. | 34 // Handle the indexed db related communication for this entire renderer. |
| 32 class IndexedDBDispatcher : public IPC::Channel::Listener { | 35 class IndexedDBDispatcher : public IPC::Channel::Listener { |
| 33 public: | 36 public: |
| 34 IndexedDBDispatcher(); | 37 IndexedDBDispatcher(); |
| 35 virtual ~IndexedDBDispatcher(); | 38 virtual ~IndexedDBDispatcher(); |
| 36 | 39 |
| 37 // IPC::Channel::Listener implementation. | 40 // IPC::Channel::Listener implementation. |
| 38 virtual bool OnMessageReceived(const IPC::Message& msg); | 41 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 39 | 42 |
| 40 void RequestIDBFactoryGetDatabaseNames( | 43 void RequestIDBFactoryGetDatabaseNames( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| 154 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); | 157 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); |
| 155 | 158 |
| 159 void CursorDestroyed(int32 cursor_id); | |
|
michaeln
2011/11/03 18:10:04
nit: since the previous method is 'static', can yo
hans
2011/11/04 10:09:44
Done.
| |
| 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 |