Skip to content

Commit

Permalink
Remove legacy IDB backend IPC glue for string-based references.
Browse files Browse the repository at this point in the history
Now that webkit is using the int64-based references for objects, remove the glue code.

BUG=


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167396 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
alecflett@chromium.org committed Nov 13, 2012
1 parent 131a8b1 commit bcd295e
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 469 deletions.
162 changes: 0 additions & 162 deletions content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,9 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore,
OnCreateObjectStore)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStoreOld,
OnDeleteObjectStoreOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore,
OnDeleteObjectStore)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransactionOld,
OnTransactionOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed)
Expand Down Expand Up @@ -392,23 +388,6 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore(
}
}

void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStoreOld(
int32 idb_database_id,
const string16& name,
int32 transaction_id,
WebKit::WebExceptionCode* ec) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
&map_, idb_database_id);
WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
&parent_->transaction_dispatcher_host_->map_, transaction_id);
if (!idb_database || !idb_transaction)
return;

*ec = 0;
idb_database->deleteObjectStore(name, *idb_transaction, *ec);
}

void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore(
int32 idb_database_id,
int64 index_id,
Expand Down Expand Up @@ -446,33 +425,6 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion(
*ec);
}

void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransactionOld(
int32 thread_id,
int32 idb_database_id,
const std::vector<string16>& names,
int32 mode,
int32* idb_transaction_id,
WebKit::WebExceptionCode* ec) {
WebIDBDatabase* database = parent_->GetOrTerminateProcess(
&map_, idb_database_id);
if (!database)
return;

WebDOMStringList object_stores;
for (std::vector<string16>::const_iterator it = names.begin();
it != names.end(); ++it) {
object_stores.append(*it);
}

*ec = 0;
WebIDBTransaction* transaction = database->transaction(
object_stores, mode, *ec);
DCHECK(!transaction != !*ec);
*idb_transaction_id =
*ec ? 0 : parent_->Add(transaction, thread_id,
database_url_map_[idb_database_id]);
}

void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
int32 thread_id,
int32 idb_database_id,
Expand Down Expand Up @@ -675,23 +627,15 @@ bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived(
IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost,
message, *msg_is_ok)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePutOld, OnPutOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexKeysOld,
OnSetIndexKeysOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexKeys,
OnSetIndexKeys)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexesReadyOld,
OnSetIndexesReadyOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexesReady,
OnSetIndexesReady)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreClear, OnClear)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndexOld, OnIndexOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndexOld,
OnDeleteIndexOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount)
Expand Down Expand Up @@ -728,31 +672,6 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet(
DCHECK(!ec);
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPutOld(
const IndexedDBHostMsg_ObjectStorePutOld_Params& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
&map_, params.object_store_ipc_id);
WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
&parent_->transaction_dispatcher_host_->map_, params.transaction_id);
if (!idb_transaction || !idb_object_store)
return;

WebKit::WebExceptionCode ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id,
params.response_id));
idb_object_store->putWithIndexKeys(params.serialized_value, params.key,
params.put_mode, callbacks.release(),
*idb_transaction, params.index_names,
params.index_keys, ec);
DCHECK(!ec);
int64 size = UTF16ToUTF8(params.serialized_value.data()).size();
WebIDBTransactionIDToSizeMap* map =
&parent_->transaction_dispatcher_host_->transaction_size_map_;
(*map)[params.transaction_id] += size;
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
const IndexedDBHostMsg_ObjectStorePut_Params& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
Expand All @@ -776,24 +695,6 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
(*map)[params.transaction_id] += size;
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeysOld(
int32 object_store_ipc_id,
const IndexedDBKey& primary_key,
const std::vector<string16>& index_names,
const std::vector<std::vector<IndexedDBKey> >& index_keys,
int32 transaction_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
&map_, object_store_ipc_id);
WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
&parent_->transaction_dispatcher_host_->map_, transaction_id);
if (!idb_transaction || !idb_object_store)
return;
idb_object_store->setIndexKeys(primary_key,
WebVector<WebKit::WebString>(index_names),
index_keys, *idb_transaction);
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeys(
int32 object_store_ipc_id,
const IndexedDBKey& primary_key,
Expand All @@ -812,22 +713,6 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeys(
index_keys, *idb_transaction);
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexesReadyOld(
int32 object_store_ipc_id,
const std::vector<string16>& index_names,
int32 transaction_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
&map_, object_store_ipc_id);
WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
&parent_->transaction_dispatcher_host_->map_, transaction_id);
if (!idb_transaction || !idb_object_store)
return;

idb_object_store->setIndexesReady(WebVector<WebKit::WebString>(index_names),
*idb_transaction);
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexesReady(
int32 object_store_ipc_id,
const std::vector<int64>& index_ids,
Expand Down Expand Up @@ -912,21 +797,6 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex(
}
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexOld(
int32 object_store_ipc_id,
const string16& name,
int32* idb_index_id,
WebKit::WebExceptionCode* ec) {
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
&map_, object_store_ipc_id);
if (!idb_object_store)
return;

*ec = 0;
WebIDBIndex* index = idb_object_store->index(name, *ec);
*idb_index_id = parent_->Add(index);
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex(
int32 object_store_ipc_id,
int64 index_id,
Expand All @@ -940,23 +810,6 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex(
*idb_index_id = parent_->Add(index);
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndexOld(
int32 object_store_ipc_id,
const string16& name,
int32 transaction_id,
WebKit::WebExceptionCode* ec) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
&map_, object_store_ipc_id);
WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
&parent_->transaction_dispatcher_host_->map_, transaction_id);
if (!idb_object_store || !idb_transaction)
return;

*ec = 0;
idb_object_store->deleteIndex(name, *idb_transaction, *ec);
}

void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndex(
int32 object_store_ipc_id,
int64 index_id,
Expand Down Expand Up @@ -1169,8 +1022,6 @@ bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived(
message, *msg_is_ok)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionCommit, OnCommit)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionAbort, OnAbort)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionObjectStoreOld,
OnObjectStoreOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionObjectStore, OnObjectStore)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionDidCompleteTaskEvents,
OnDidCompleteTaskEvents)
Expand Down Expand Up @@ -1205,19 +1056,6 @@ void IndexedDBDispatcherHost::TransactionDispatcherHost::OnAbort(
idb_transaction->abort();
}

void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStoreOld(
int32 transaction_id, const string16& name, int32* object_store_ipc_id,
WebKit::WebExceptionCode* ec) {
WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
&map_, transaction_id);
if (!idb_transaction)
return;

*ec = 0;
WebIDBObjectStore* object_store = idb_transaction->objectStore(name, *ec);
*object_store_ipc_id = object_store ? parent_->Add(object_store) : 0;
}

void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore(
int32 transaction_id, int64 object_store_id, int32* object_store_ipc_id,
WebKit::WebExceptionCode* ec) {
Expand Down
33 changes: 0 additions & 33 deletions content/browser/in_process_webkit/indexed_db_dispatcher_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ struct IndexedDBHostMsg_IndexOpenCursor_Params;
struct IndexedDBHostMsg_ObjectStoreCount_Params;
struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params;
struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params;
struct IndexedDBHostMsg_ObjectStorePutOld_Params;
struct IndexedDBHostMsg_ObjectStorePut_Params;

namespace WebKit {
Expand Down Expand Up @@ -117,10 +116,6 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
void OnCreateObjectStore(
const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params,
int32* object_store_id, WebKit::WebExceptionCode* ec);
void OnDeleteObjectStoreOld(int32 idb_database_id,
const string16& name,
int32 transaction_id,
WebKit::WebExceptionCode* ec);
void OnDeleteObjectStore(int32 idb_database_id,
int64 object_store_id,
int32 transaction_id,
Expand All @@ -130,12 +125,6 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
int32 response_id,
const string16& version,
WebKit::WebExceptionCode* ec);
void OnTransactionOld(int32 thread_id,
int32 idb_database_id,
const std::vector<string16>& names,
int32 mode,
int32* idb_transaction_id,
WebKit::WebExceptionCode* ec);
void OnTransaction(int32 thread_id,
int32 idb_database_id,
const std::vector<int64>& names,
Expand Down Expand Up @@ -191,23 +180,13 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
int32 response_id,
const IndexedDBKeyRange& key_range,
int32 transaction_id);
void OnPutOld(const IndexedDBHostMsg_ObjectStorePutOld_Params& params);
void OnPut(const IndexedDBHostMsg_ObjectStorePut_Params& params);
void OnSetIndexKeysOld(
int32 idb_object_store_id,
const IndexedDBKey& primary_key,
const std::vector<string16>& index_names,
const std::vector<std::vector<IndexedDBKey> >& index_keys,
int32 transaction_id);
void OnSetIndexKeys(
int32 idb_object_store_id,
const IndexedDBKey& primary_key,
const std::vector<int64>& index_ids,
const std::vector<std::vector<IndexedDBKey> >& index_keys,
int32 transaction_id);
void OnSetIndexesReadyOld(int32 idb_object_store_id,
const std::vector<string16>& names,
int32 transaction_id);
void OnSetIndexesReady(int32 idb_object_store_id,
const std::vector<int64>& ids,
int32 transaction_id);
Expand All @@ -224,17 +203,9 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params,
int32* index_id,
WebKit::WebExceptionCode* ec);
void OnIndexOld(int32 idb_object_store_id,
const string16& name,
int32* idb_index_id,
WebKit::WebExceptionCode* ec);
void OnIndex(int32 idb_object_store_id,
int64 index_id,
int32* idb_index_id);
void OnDeleteIndexOld(int32 idb_object_store_id,
const string16& name,
int32 transaction_id,
WebKit::WebExceptionCode* ec);
void OnDeleteIndex(int32 idb_object_store_id,
int64 index_id,
int32 transaction_id,
Expand Down Expand Up @@ -293,10 +264,6 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {

void OnCommit(int32 transaction_id);
void OnAbort(int32 transaction_id);
void OnObjectStoreOld(int32 transaction_id,
const string16& name,
int32* object_store_ipc_id,
WebKit::WebExceptionCode* ec);
void OnObjectStore(int32 transaction_id,
int64 object_store_id,
int32* object_store_ipc_id,
Expand Down
40 changes: 0 additions & 40 deletions content/common/indexed_db/indexed_db_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,46 +393,6 @@ void IndexedDBDispatcher::RequestIDBObjectStoreGet(
key_range, TransactionId(transaction)));
}

void IndexedDBDispatcher::RequestIDBObjectStorePut(
const SerializedScriptValue& value,
const IndexedDBKey& key,
WebKit::WebIDBObjectStore::PutMode put_mode,
WebIDBCallbacks* callbacks_ptr,
int32 object_store_ipc_id,
const WebIDBTransaction& transaction,
const WebKit::WebVector<WebKit::WebString>& index_names,
const WebKit::WebVector<WebKit::WebVector<WebKit::WebIDBKey> >& index_keys,
WebExceptionCode* ec) {
ResetCursorPrefetchCaches();
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
if (!value.is_null() &&
(value.data().length() * sizeof(char16)) > kMaxIDBValueSizeInBytes) {
*ec = WebKit::WebIDBDatabaseExceptionDataError;
return;
}
IndexedDBHostMsg_ObjectStorePutOld_Params params;
params.thread_id = CurrentWorkerId();
params.object_store_ipc_id = object_store_ipc_id;
params.response_id = pending_callbacks_.Add(callbacks.release());
params.serialized_value = value;
params.key = key;
params.put_mode = put_mode;
params.transaction_id = TransactionId(transaction);
params.index_names.resize(index_names.size());
for (size_t i = 0; i < index_names.size(); ++i) {
params.index_names[i] = index_names[i];
}

params.index_keys.resize(index_keys.size());
for (size_t i = 0; i < index_keys.size(); ++i) {
params.index_keys[i].resize(index_keys[i].size());
for (size_t j = 0; j < index_keys[i].size(); ++j) {
params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]);
}
}
Send(new IndexedDBHostMsg_ObjectStorePutOld(params));
}

void IndexedDBDispatcher::RequestIDBObjectStorePut(
const SerializedScriptValue& value,
const IndexedDBKey& key,
Expand Down
Loading

0 comments on commit bcd295e

Please sign in to comment.