Commit 0563ebe4 authored by dgrogan@chromium.org's avatar dgrogan@chromium.org

Chrome side changes for integer versions

BUG=108223
TEST=


Review URL: https://chromiumcodereview.appspot.com/10829013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148673 0039d316-1c4b-4281-b951-d872f2087c98
parent fe5195f1
...@@ -27,11 +27,32 @@ void IndexedDBCallbacksBase::onError(const WebKit::WebIDBDatabaseError& error) { ...@@ -27,11 +27,32 @@ void IndexedDBCallbacksBase::onError(const WebKit::WebIDBDatabaseError& error) {
thread_id_, response_id_, error.code(), error.message())); thread_id_, response_id_, error.code(), error.message()));
} }
void IndexedDBCallbacksBase::onBlocked(long long old_version) {
dispatcher_host_->Send(new IndexedDBMsg_CallbacksIntBlocked(
thread_id_, response_id_, old_version));
}
void IndexedDBCallbacksBase::onBlocked() { void IndexedDBCallbacksBase::onBlocked() {
dispatcher_host_->Send(new IndexedDBMsg_CallbacksBlocked(thread_id_, dispatcher_host_->Send(new IndexedDBMsg_CallbacksBlocked(thread_id_,
response_id_)); response_id_));
} }
template<>
void IndexedDBCallbacks<WebKit::WebIDBDatabase>::onUpgradeNeeded(
long long old_version,
WebKit::WebIDBTransaction* transaction,
WebKit::WebIDBDatabase* database) {
int32 transaction_id = dispatcher_host()->Add(transaction, thread_id(),
origin_url_);
int32 database_id = dispatcher_host()->Add(database, thread_id(),
origin_url_);
database_id_ = database_id;
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksUpgradeNeeded(
thread_id(), response_id(), transaction_id, database_id,
old_version));
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
WebKit::WebIDBCursor* idb_object) { WebKit::WebIDBCursor* idb_object) {
int32 object_id = dispatcher_host()->Add(idb_object); int32 object_id = dispatcher_host()->Add(idb_object);
......
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.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/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/WebIDBDatabaseError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
class IndexedDBMsg_CallbacksSuccessIDBDatabase; class IndexedDBMsg_CallbacksSuccessIDBDatabase;
class IndexedDBMsg_CallbacksSuccessIDBTransaction; class IndexedDBMsg_CallbacksSuccessIDBTransaction;
class IndexedDBMsg_CallbacksUpgradeNeeded;
// Template magic to figure out what message to send to the renderer based on // Template magic to figure out what message to send to the renderer based on
// which (overloaded) onSuccess method we expect to be called. // which (overloaded) onSuccess method we expect to be called.
...@@ -28,6 +30,10 @@ template <> struct WebIDBToMsgHelper<WebKit::WebIDBTransaction> { ...@@ -28,6 +30,10 @@ template <> struct WebIDBToMsgHelper<WebKit::WebIDBTransaction> {
typedef IndexedDBMsg_CallbacksSuccessIDBTransaction MsgType; typedef IndexedDBMsg_CallbacksSuccessIDBTransaction MsgType;
}; };
namespace {
int32 kDatabaseNotAdded = -1;
}
// The code the following two classes share. // The code the following two classes share.
class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks { class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks {
public: public:
...@@ -39,6 +45,7 @@ class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks { ...@@ -39,6 +45,7 @@ class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks {
virtual void onError(const WebKit::WebIDBDatabaseError& error); virtual void onError(const WebKit::WebIDBDatabaseError& error);
virtual void onBlocked(); virtual void onBlocked();
virtual void onBlocked(long long old_version);
protected: protected:
IndexedDBDispatcherHost* dispatcher_host() const { IndexedDBDispatcherHost* dispatcher_host() const {
...@@ -65,20 +72,36 @@ class IndexedDBCallbacks : public IndexedDBCallbacksBase { ...@@ -65,20 +72,36 @@ class IndexedDBCallbacks : public IndexedDBCallbacksBase {
int32 response_id, int32 response_id,
const GURL& origin_url) const GURL& origin_url)
: IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id), : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id),
origin_url_(origin_url) { origin_url_(origin_url),
database_id_(kDatabaseNotAdded) {
} }
virtual void onSuccess(WebObjectType* idb_object) { virtual void onSuccess(WebObjectType* idb_object) {
int32 object_id = dispatcher_host()->Add(idb_object, thread_id(), int32 object_id = database_id_;
origin_url_); 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( dispatcher_host()->Send(
new typename WebIDBToMsgHelper<WebObjectType>::MsgType(thread_id(), new typename WebIDBToMsgHelper<WebObjectType>::MsgType(thread_id(),
response_id(), response_id(),
object_id)); object_id));
} }
void onUpgradeNeeded(
long long old_version,
WebKit::WebIDBTransaction* transaction,
WebKit::WebIDBDatabase* database) {
NOTREACHED();
}
private: private:
GURL origin_url_; GURL origin_url_;
int32 database_id_;
DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
}; };
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -19,6 +19,15 @@ IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks( ...@@ -19,6 +19,15 @@ IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks(
IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() { IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() {
} }
void IndexedDBDatabaseCallbacks::onVersionChange(long long old_version,
long long new_version) {
dispatcher_host_->Send(
new IndexedDBMsg_DatabaseCallbacksIntVersionChange(thread_id_,
database_id_,
old_version,
new_version));
}
void IndexedDBDatabaseCallbacks::onVersionChange( void IndexedDBDatabaseCallbacks::onVersionChange(
const WebKit::WebString& requested_version) { const WebKit::WebString& requested_version) {
dispatcher_host_->Send( dispatcher_host_->Send(
......
...@@ -19,6 +19,8 @@ class IndexedDBDatabaseCallbacks ...@@ -19,6 +19,8 @@ class IndexedDBDatabaseCallbacks
virtual ~IndexedDBDatabaseCallbacks(); virtual ~IndexedDBDatabaseCallbacks();
virtual void onVersionChange(long long old_version,
long long new_version);
virtual void onVersionChange(const WebKit::WebString& requested_version); virtual void onVersionChange(const WebKit::WebString& requested_version);
private: private:
......
...@@ -242,6 +242,7 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen( ...@@ -242,6 +242,7 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen(
// created) if this origin is already over quota. // created) if this origin is already over quota.
Context()->GetIDBFactory()->open( Context()->GetIDBFactory()->open(
params.name, params.name,
params.version,
new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id, new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id,
params.response_id, origin_url), params.response_id, origin_url),
origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path));
...@@ -276,6 +277,7 @@ ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( ...@@ -276,6 +277,7 @@ ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
ObjectType* return_object = map->Lookup(return_object_id); ObjectType* return_object = map->Lookup(return_object_id);
if (!return_object) { if (!return_object) {
NOTREACHED() << "Uh oh, couldn't find object with id " << return_object_id;
content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF")); content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF"));
BadMessageReceived(); BadMessageReceived();
} }
...@@ -1143,6 +1145,8 @@ void IndexedDBDispatcherHost:: ...@@ -1143,6 +1145,8 @@ void IndexedDBDispatcherHost::
void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
int32 object_id) { int32 object_id) {
// TODO(dgrogan): This doesn't seem to be happening with some version change
// transactions. Possibly introduced with integer version support.
transaction_size_map_.erase(object_id); transaction_size_map_.erase(object_id);
transaction_url_map_.erase(object_id); transaction_url_map_.erase(object_id);
parent_->DestroyObject(&map_, object_id); parent_->DestroyObject(&map_, object_id);
......
...@@ -104,15 +104,20 @@ void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { ...@@ -104,15 +104,20 @@ void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) {
OnSuccessSerializedScriptValueWithKey) OnSuccessSerializedScriptValueWithKey)
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError)
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked)
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked)
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded)
IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort)
IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete)
IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange,
OnIntVersionChange)
IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange,
OnVersionChange) OnVersionChange)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
// If a message gets here, IndexedDBMessageFilter already determined that it // If a message gets here, IndexedDBMessageFilter already determined that it
// is an IndexedDB message. // is an IndexedDB message.
DCHECK(handled); DCHECK(handled) << "Didn't handle a message defined at line "
<< IPC_MESSAGE_ID_LINE(msg.type());
} }
bool IndexedDBDispatcher::Send(IPC::Message* msg) { bool IndexedDBDispatcher::Send(IPC::Message* msg) {
...@@ -216,6 +221,7 @@ void IndexedDBDispatcher::RequestIDBCursorDelete( ...@@ -216,6 +221,7 @@ void IndexedDBDispatcher::RequestIDBCursorDelete(
void IndexedDBDispatcher::RequestIDBFactoryOpen( void IndexedDBDispatcher::RequestIDBFactoryOpen(
const string16& name, const string16& name,
int64 version,
WebIDBCallbacks* callbacks_ptr, WebIDBCallbacks* callbacks_ptr,
const string16& origin, const string16& origin,
WebFrame* web_frame) { WebFrame* web_frame) {
...@@ -231,6 +237,7 @@ void IndexedDBDispatcher::RequestIDBFactoryOpen( ...@@ -231,6 +237,7 @@ void IndexedDBDispatcher::RequestIDBFactoryOpen(
params.response_id = pending_callbacks_.Add(callbacks.release()); params.response_id = pending_callbacks_.Add(callbacks.release());
params.origin = origin; params.origin = origin;
params.name = name; params.name = name;
params.version = version;
Send(new IndexedDBHostMsg_FactoryOpen(params)); Send(new IndexedDBHostMsg_FactoryOpen(params));
} }
...@@ -275,7 +282,10 @@ void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase( ...@@ -275,7 +282,10 @@ void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase(
void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 idb_database_id) { void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 idb_database_id) {
ResetCursorPrefetchCaches(); ResetCursorPrefetchCaches();
Send(new IndexedDBHostMsg_DatabaseClose(idb_database_id)); Send(new IndexedDBHostMsg_DatabaseClose(idb_database_id));
pending_database_callbacks_.Remove(idb_database_id); // There won't be pending database callbacks if the transaction was aborted in
// the initial upgradeneeded event handler.
if (pending_database_callbacks_.Lookup(idb_database_id))
pending_database_callbacks_.Remove(idb_database_id);
} }
void IndexedDBDispatcher::RequestIDBDatabaseOpen( void IndexedDBDispatcher::RequestIDBDatabaseOpen(
...@@ -542,6 +552,11 @@ void IndexedDBDispatcher::CursorDestroyed(int32 cursor_id) { ...@@ -542,6 +552,11 @@ void IndexedDBDispatcher::CursorDestroyed(int32 cursor_id) {
cursors_.erase(cursor_id); cursors_.erase(cursor_id);
} }
void IndexedDBDispatcher::DatabaseDestroyed(int32 database_id) {
DCHECK_EQ(databases_.count(database_id), 1u);
databases_.erase(database_id);
}
int32 IndexedDBDispatcher::TransactionId( int32 IndexedDBDispatcher::TransactionId(
const WebIDBTransaction& transaction) { const WebIDBTransaction& transaction) {
const RendererWebIDBTransactionImpl* impl = const RendererWebIDBTransactionImpl* impl =
...@@ -556,7 +571,11 @@ void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 thread_id, ...@@ -556,7 +571,11 @@ void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 thread_id,
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks) if (!callbacks)
return; return;
callbacks->onSuccess(new RendererWebIDBDatabaseImpl(object_id)); // If an upgrade was performed, count will be non-zero.
if (!databases_.count(object_id))
databases_[object_id] = new RendererWebIDBDatabaseImpl(object_id);
DCHECK_EQ(databases_.count(object_id), 1u);
callbacks->onSuccess(databases_[object_id]);
pending_callbacks_.Remove(response_id); pending_callbacks_.Remove(response_id);
} }
...@@ -689,6 +708,30 @@ void IndexedDBDispatcher::OnBlocked(int32 thread_id, int32 response_id) { ...@@ -689,6 +708,30 @@ void IndexedDBDispatcher::OnBlocked(int32 thread_id, int32 response_id) {
callbacks->onBlocked(); callbacks->onBlocked();
} }
void IndexedDBDispatcher::OnIntBlocked(int32 thread_id,
int32 response_id,
int64 existing_version) {
DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
DCHECK(callbacks);
callbacks->onBlocked(existing_version);
}
void IndexedDBDispatcher::OnUpgradeNeeded(int32 thread_id,
int32 response_id,
int32 transaction_id,
int32 database_id,
int64 old_version) {
DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
DCHECK(callbacks);
DCHECK(!databases_.count(database_id));
databases_[database_id] = new RendererWebIDBDatabaseImpl(database_id);
callbacks->onUpgradeNeeded(old_version,
new RendererWebIDBTransactionImpl(transaction_id),
databases_[database_id]);
}
void IndexedDBDispatcher::OnError(int32 thread_id, int32 response_id, int code, void IndexedDBDispatcher::OnError(int32 thread_id, int32 response_id, int code,
const string16& message) { const string16& message) {
DCHECK_EQ(thread_id, CurrentWorkerId()); DCHECK_EQ(thread_id, CurrentWorkerId());
...@@ -719,6 +762,20 @@ void IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) { ...@@ -719,6 +762,20 @@ void IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) {
pending_transaction_callbacks_.Remove(transaction_id); pending_transaction_callbacks_.Remove(transaction_id);
} }
void IndexedDBDispatcher::OnIntVersionChange(int32 thread_id,
int32 database_id,
int64 old_version,
int64 new_version) {
DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBDatabaseCallbacks* callbacks =
pending_database_callbacks_.Lookup(database_id);
// callbacks would be NULL if a versionchange event is received after close
// has been called.
if (!callbacks)
return;
callbacks->onVersionChange(old_version, new_version);
}
void IndexedDBDispatcher::OnVersionChange(int32 thread_id, void IndexedDBDispatcher::OnVersionChange(int32 thread_id,
int32 database_id, int32 database_id,
const string16& newVersion) { const string16& newVersion) {
......
...@@ -24,6 +24,7 @@ struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params; ...@@ -24,6 +24,7 @@ struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params;
struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params; struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params;
struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params; struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params;
class RendererWebIDBCursorImpl; class RendererWebIDBCursorImpl;
class RendererWebIDBDatabaseImpl;
namespace IPC { namespace IPC {
class Message; class Message;
...@@ -70,6 +71,7 @@ class CONTENT_EXPORT IndexedDBDispatcher ...@@ -70,6 +71,7 @@ class CONTENT_EXPORT IndexedDBDispatcher
void RequestIDBFactoryOpen( void RequestIDBFactoryOpen(
const string16& name, const string16& name,
int64 version,
WebKit::WebIDBCallbacks* callbacks, WebKit::WebIDBCallbacks* callbacks,
const string16& origin, const string16& origin,
WebKit::WebFrame* web_frame); WebKit::WebFrame* web_frame);
...@@ -213,6 +215,7 @@ class CONTENT_EXPORT IndexedDBDispatcher ...@@ -213,6 +215,7 @@ class CONTENT_EXPORT IndexedDBDispatcher
int32 id); int32 id);
void CursorDestroyed(int32 cursor_id); void CursorDestroyed(int32 cursor_id);
void DatabaseDestroyed(int32 database_id);
static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); static int32 TransactionId(const WebKit::WebIDBTransaction& transaction);
...@@ -254,11 +257,21 @@ class CONTENT_EXPORT IndexedDBDispatcher ...@@ -254,11 +257,21 @@ class CONTENT_EXPORT IndexedDBDispatcher
int code, int code,
const string16& message); const string16& message);
void OnBlocked(int32 thread_id, int32 response_id); void OnBlocked(int32 thread_id, int32 response_id);
void OnIntBlocked(int32 thread_id, int32 response_id, int64 existing_version);
void OnUpgradeNeeded(int32 thread_id,
int32 response_id,
int32 transaction_id,
int32 database_id,
int64 old_version);
void OnAbort(int32 thread_id, int32 transaction_id); void OnAbort(int32 thread_id, int32 transaction_id);
void OnComplete(int32 thread_id, int32 transaction_id); void OnComplete(int32 thread_id, int32 transaction_id);
void OnVersionChange(int32 thread_id, void OnVersionChange(int32 thread_id,
int32 database_id, int32 database_id,
const string16& newVersion); const string16& newVersion);
void OnIntVersionChange(int32 thread_id,
int32 database_id,
int64 old_version,
int64 new_version);
// Reset cursor prefetch caches for all cursors except exception_cursor_id. // Reset cursor prefetch caches for all cursors except exception_cursor_id.
void ResetCursorPrefetchCaches(int32 exception_cursor_id = -1); void ResetCursorPrefetchCaches(int32 exception_cursor_id = -1);
...@@ -274,6 +287,8 @@ class CONTENT_EXPORT IndexedDBDispatcher ...@@ -274,6 +287,8 @@ class CONTENT_EXPORT IndexedDBDispatcher
// Map from cursor id to RendererWebIDBCursorImpl. // Map from cursor id to RendererWebIDBCursorImpl.
std::map<int32, RendererWebIDBCursorImpl*> cursors_; std::map<int32, RendererWebIDBCursorImpl*> cursors_;
std::map<int32, RendererWebIDBDatabaseImpl*> databases_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher);
}; };
......
...@@ -42,6 +42,8 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryOpen_Params) ...@@ -42,6 +42,8 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryOpen_Params)
IPC_STRUCT_MEMBER(string16, origin) IPC_STRUCT_MEMBER(string16, origin)
// The name of the database. // The name of the database.
IPC_STRUCT_MEMBER(string16, name) IPC_STRUCT_MEMBER(string16, name)
// The requested version of the database.
IPC_STRUCT_MEMBER(int64, version)
IPC_STRUCT_END() IPC_STRUCT_END()
// Used to delete an indexed database. // Used to delete an indexed database.
...@@ -245,6 +247,16 @@ IPC_MESSAGE_CONTROL4(IndexedDBMsg_CallbacksError, ...@@ -245,6 +247,16 @@ IPC_MESSAGE_CONTROL4(IndexedDBMsg_CallbacksError,
IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksBlocked, IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksBlocked,
int32 /* thread_id */, int32 /* thread_id */,
int32 /* response_id */) int32 /* response_id */)
IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksIntBlocked,
int32 /* thread_id */,
int32 /* response_id */,
int64 /* existing_version */)
IPC_MESSAGE_CONTROL5(IndexedDBMsg_CallbacksUpgradeNeeded,
int32, /* thread_id */
int32, /* response_id */
int32, /* transaction_id */
int32, /* database_id */
int64) /* old_version */
// IDBTransactionCallback message handlers. // IDBTransactionCallback message handlers.
IPC_MESSAGE_CONTROL2(IndexedDBMsg_TransactionCallbacksAbort, IPC_MESSAGE_CONTROL2(IndexedDBMsg_TransactionCallbacksAbort,
...@@ -259,6 +271,12 @@ IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksVersionChange, ...@@ -259,6 +271,12 @@ IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksVersionChange,
int32, /* database_id */ int32, /* database_id */
string16) /* new_version */ string16) /* new_version */
IPC_MESSAGE_CONTROL4(IndexedDBMsg_DatabaseCallbacksIntVersionChange,
int32, /* thread_id */
int32, /* database_id */
int64, /* old_version */
int64) /* new_version */
// Indexed DB messages sent from the renderer to the browser. // Indexed DB messages sent from the renderer to the browser.
// WebIDBCursor::update() message. // WebIDBCursor::update() message.
......
...@@ -38,6 +38,9 @@ RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { ...@@ -38,6 +38,9 @@ RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() {
// any such pointers. // any such pointers.
IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseDestroyed( IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseDestroyed(
idb_database_id_)); idb_database_id_));
IndexedDBDispatcher* dispatcher =
IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->DatabaseDestroyed(idb_database_id_);
} }
WebIDBMetadata RendererWebIDBDatabaseImpl::metadata() const { WebIDBMetadata RendererWebIDBDatabaseImpl::metadata() const {
......
...@@ -35,6 +35,7 @@ void RendererWebIDBFactoryImpl::getDatabaseNames( ...@@ -35,6 +35,7 @@ void RendererWebIDBFactoryImpl::getDatabaseNames(
void RendererWebIDBFactoryImpl::open( void RendererWebIDBFactoryImpl::open(
const WebString& name, const WebString& name,
long long version,
WebIDBCallbacks* callbacks, WebIDBCallbacks* callbacks,
const WebSecurityOrigin& origin, const WebSecurityOrigin& origin,
WebFrame* web_frame, WebFrame* web_frame,
...@@ -44,7 +45,7 @@ void RendererWebIDBFactoryImpl::open( ...@@ -44,7 +45,7 @@ void RendererWebIDBFactoryImpl::open(
IndexedDBDispatcher* dispatcher = IndexedDBDispatcher* dispatcher =
IndexedDBDispatcher::ThreadSpecificInstance(); IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBFactoryOpen( dispatcher->RequestIDBFactoryOpen(
name, callbacks, origin.databaseIdentifier(), web_frame); name, version, callbacks, origin.databaseIdentifier(), web_frame);
} }
void RendererWebIDBFactoryImpl::deleteDatabase( void RendererWebIDBFactoryImpl::deleteDatabase(
......
...@@ -29,6 +29,7 @@ class RendererWebIDBFactoryImpl : public WebKit::WebIDBFactory { ...@@ -29,6 +29,7 @@ class RendererWebIDBFactoryImpl : public WebKit::WebIDBFactory {
virtual void open( virtual void open(
const WebKit::WebString& name, const WebKit::WebString& name,
long long version,
WebKit::WebIDBCallbacks* callbacks, WebKit::WebIDBCallbacks* callbacks,
const WebKit::WebSecurityOrigin& origin, const WebKit::WebSecurityOrigin& origin,
WebKit::WebFrame* web_frame, WebKit::WebFrame* web_frame,
......
...@@ -353,11 +353,12 @@ class TestWebIDBFactory : public WebKit::WebIDBFactory { ...@@ -353,11 +353,12 @@ class TestWebIDBFactory : public WebKit::WebIDBFactory {
} }
virtual void open(const WebString& name, virtual void open(const WebString& name,
long long version,
WebKit::WebIDBCallbacks* callbacks, WebKit::WebIDBCallbacks* callbacks,
const WebKit::WebSecurityOrigin& origin, const WebKit::WebSecurityOrigin& origin,
WebKit::WebFrame* frame, WebKit::WebFrame* frame,
const WebString& dataDir) { const WebString& dataDir) {
factory_->open(name, callbacks, origin, frame, factory_->open(name, version, callbacks, origin, frame,
dataDir.isEmpty() ? data_dir_ : dataDir); dataDir.isEmpty() ? data_dir_ : dataDir);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment