Chromium Code Reviews| Index: content/browser/in_process_webkit/indexed_db_callbacks.cc |
| diff --git a/content/browser/in_process_webkit/indexed_db_callbacks.cc b/content/browser/in_process_webkit/indexed_db_callbacks.cc |
| index 291e2fbdb9dca42c07c2d106f3782b989179584c..131805e45e31495a88cda610a699b4ee50c38ba9 100644 |
| --- a/content/browser/in_process_webkit/indexed_db_callbacks.cc |
| +++ b/content/browser/in_process_webkit/indexed_db_callbacks.cc |
| @@ -11,6 +11,10 @@ using content::IndexedDBKey; |
| using content::IndexedDBKeyPath; |
| using content::SerializedScriptValue; |
| +namespace { |
| +int32 kDatabaseNotAdded = -1; |
|
jsbell
2012/08/29 15:50:07
const?
dgrogan
2012/08/29 18:43:23
Done.
|
| +} |
| + |
| IndexedDBCallbacksBase::IndexedDBCallbacksBase( |
| IndexedDBDispatcherHost* dispatcher_host, |
| int32 thread_id, |
| @@ -37,8 +41,49 @@ void IndexedDBCallbacksBase::onBlocked() { |
| response_id_)); |
| } |
| -template<> |
| -void IndexedDBCallbacks<WebKit::WebIDBDatabase>::onUpgradeNeeded( |
| +IndexedDBCallbacksTransaction::IndexedDBCallbacksTransaction( |
| + IndexedDBDispatcherHost* dispatcher_host, |
| + int32 thread_id, |
| + int32 response_id, |
| + const GURL& origin_url) |
| + : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id), |
| + origin_url_(origin_url) { |
|
jsbell
2012/08/29 15:50:07
Indenting.
dgrogan
2012/08/29 18:43:23
Done.
|
| +} |
| + |
| +void IndexedDBCallbacksTransaction::onSuccess( |
| + WebKit::WebIDBTransaction* idb_object) { |
| + int32 object_id = |
| + dispatcher_host()->Add(idb_object, thread_id(), origin_url_); |
| + dispatcher_host()->Send( |
| + new IndexedDBMsg_CallbacksSuccessIDBTransaction(thread_id(), |
| + response_id(), object_id)); |
| +} |
| + |
| +IndexedDBCallbacksDatabase::IndexedDBCallbacksDatabase( |
| + IndexedDBDispatcherHost* dispatcher_host, |
| + int32 thread_id, |
| + int32 response_id, |
| + const GURL& origin_url) |
| + : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id), |
| + origin_url_(origin_url), |
|
jsbell
2012/08/29 15:50:07
Indenting.
dgrogan
2012/08/29 18:43:23
Done.
|
| + database_id_(kDatabaseNotAdded) { |
|
jsbell
2012/08/29 15:50:07
Ditto.
dgrogan
2012/08/29 18:43:23
Done.
|
| +} |
| + |
| +void IndexedDBCallbacksDatabase::onSuccess( |
| + WebKit::WebIDBDatabase* idb_object) { |
| + int32 object_id = database_id_; |
| + if (object_id == kDatabaseNotAdded) { |
| + object_id = dispatcher_host()->Add(idb_object, thread_id(), origin_url_); |
| + } else { |
| + // We already have this database and don't need a new copy of it. |
| + delete idb_object; |
| + } |
| + dispatcher_host()->Send( |
| + new IndexedDBMsg_CallbacksSuccessIDBDatabase(thread_id(), response_id(), |
| + object_id)); |
| +} |
| + |
| +void IndexedDBCallbacksDatabase::onUpgradeNeeded( |
| long long old_version, |
| WebKit::WebIDBTransaction* transaction, |
| WebKit::WebIDBDatabase* database) { |