| 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..5d826c2001e40a7d00a6b3708017abfd29504a8d 100644
|
| --- a/content/browser/in_process_webkit/indexed_db_callbacks.h
|
| +++ b/content/browser/in_process_webkit/indexed_db_callbacks.h
|
| @@ -11,12 +11,14 @@
|
| #include "googleurl/src/gurl.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
|
|
| 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 +30,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 +45,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 +72,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;
|
| + }
|
| +
|
| 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);
|
| };
|
|
|
|
|