Index: content/browser/in_process_webkit/indexed_db_callbacks.h |
diff --git a/content/browser/in_process_webkit/indexed_db_callbacks.h b/content/browser/in_process_webkit/indexed_db_callbacks.h |
index 47db78f733387c808417d80a8d7f4869956a31b6..8c510399e2c70ec60d6196104124dfe061ebc527 100644 |
--- a/content/browser/in_process_webkit/indexed_db_callbacks.h |
+++ b/content/browser/in_process_webkit/indexed_db_callbacks.h |
@@ -17,6 +17,7 @@ |
class IndexedDBMsg_CallbacksSuccessIDBDatabase; |
class IndexedDBMsg_CallbacksSuccessIDBTransaction; |
+class IndexedDBMsg_CallbacksUpgradeNeeded; |
// Template magic to figure out what message to send to the renderer based on |
// which (overloaded) onSuccess method we expect to be called. |
@@ -28,6 +29,10 @@ template <> struct WebIDBToMsgHelper<WebKit::WebIDBTransaction> { |
typedef IndexedDBMsg_CallbacksSuccessIDBTransaction MsgType; |
}; |
+namespace { |
+int32 kDatabaseNotAdded = -1; |
+} |
+ |
// The code the following two classes share. |
class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks { |
public: |
@@ -39,6 +44,7 @@ class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks { |
virtual void onError(const WebKit::WebIDBDatabaseError& error); |
virtual void onBlocked(); |
+ virtual void onBlocked(long long old_version); |
protected: |
IndexedDBDispatcherHost* dispatcher_host() const { |
@@ -65,20 +71,36 @@ class IndexedDBCallbacks : public IndexedDBCallbacksBase { |
int32 response_id, |
const GURL& origin_url) |
: IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id), |
- origin_url_(origin_url) { |
+ origin_url_(origin_url), |
+ database_id_(kDatabaseNotAdded) { |
} |
virtual void onSuccess(WebObjectType* idb_object) { |
- int32 object_id = dispatcher_host()->Add(idb_object, thread_id(), |
- origin_url_); |
+ 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; |
dgrogan
2012/07/25 20:26:11
A better fix might be to add a map to IDBCallbacks
dgrogan
2012/07/25 20:27:09
That link to IDBCallbacksProxy doesn't actually im
|
+ } |
+ |
dispatcher_host()->Send( |
new typename WebIDBToMsgHelper<WebObjectType>::MsgType(thread_id(), |
response_id(), |
object_id)); |
} |
+ void onUpgradeNeeded( |
+ long long old_version, |
+ WebKit::WebIDBTransaction* transaction, |
+ WebKit::WebIDBDatabase* database) { |
+ NOTREACHED(); |
+ } |
+ |
+ |
private: |
GURL origin_url_; |
+ int32 database_id_; |
DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); |
}; |