| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/process.h" | 11 #include "base/process.h" |
| 12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" | 14 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" |
| 15 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" | 15 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" |
| 16 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 16 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 17 #include "content/browser/indexed_db/webidbcursor_impl.h" |
| 18 #include "content/browser/indexed_db/webidbcursor_impl.h" |
| 19 #include "content/browser/indexed_db/webidbdatabase_impl.h" |
| 17 #include "content/browser/renderer_host/render_message_filter.h" | 20 #include "content/browser/renderer_host/render_message_filter.h" |
| 18 #include "content/common/indexed_db/indexed_db_messages.h" | 21 #include "content/common/indexed_db/indexed_db_messages.h" |
| 19 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/user_metrics.h" | 23 #include "content/public/browser/user_metrics.h" |
| 21 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/common/result_codes.h" | 25 #include "content/public/common/result_codes.h" |
| 23 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 24 #include "third_party/WebKit/public/platform/WebData.h" | 27 #include "third_party/WebKit/public/platform/WebData.h" |
| 25 #include "third_party/WebKit/public/platform/WebIDBCursor.h" | |
| 26 #include "third_party/WebKit/public/platform/WebIDBDatabase.h" | 28 #include "third_party/WebKit/public/platform/WebIDBDatabase.h" |
| 27 #include "third_party/WebKit/public/platform/WebIDBDatabaseCallbacks.h" | |
| 28 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" | 29 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" |
| 29 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" | 30 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" |
| 30 #include "third_party/WebKit/public/platform/WebIDBFactory.h" | 31 #include "third_party/WebKit/public/platform/WebIDBFactory.h" |
| 31 #include "third_party/WebKit/public/platform/WebIDBMetadata.h" | 32 #include "third_party/WebKit/public/platform/WebIDBMetadata.h" |
| 32 #include "third_party/WebKit/public/platform/WebString.h" | 33 #include "third_party/WebKit/public/platform/WebString.h" |
| 33 #include "third_party/WebKit/public/platform/WebVector.h" | 34 #include "third_party/WebKit/public/platform/WebVector.h" |
| 34 #include "webkit/base/file_path_string_conversions.h" | 35 #include "webkit/base/file_path_string_conversions.h" |
| 35 #include "webkit/base/origin_url_conversions.h" | 36 #include "webkit/base/origin_url_conversions.h" |
| 36 #include "webkit/browser/database/database_util.h" | 37 #include "webkit/browser/database/database_util.h" |
| 37 | 38 |
| 38 using webkit_database::DatabaseUtil; | 39 using webkit_database::DatabaseUtil; |
| 39 using WebKit::WebData; | 40 using WebKit::WebData; |
| 40 using WebKit::WebIDBCallbacks; | |
| 41 using WebKit::WebIDBCursor; | |
| 42 using WebKit::WebIDBDatabase; | 41 using WebKit::WebIDBDatabase; |
| 43 using WebKit::WebIDBDatabaseError; | 42 using WebKit::WebIDBDatabaseError; |
| 44 using WebKit::WebIDBKey; | 43 using WebKit::WebIDBKey; |
| 45 using WebKit::WebIDBMetadata; | 44 using WebKit::WebIDBMetadata; |
| 46 using WebKit::WebString; | 45 using WebKit::WebString; |
| 47 using WebKit::WebVector; | 46 using WebKit::WebVector; |
| 48 | 47 |
| 49 namespace content { | 48 namespace content { |
| 50 namespace { | 49 namespace { |
| 51 | 50 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 OnIDBFactoryGetDatabaseNames) | 121 OnIDBFactoryGetDatabaseNames) |
| 123 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) | 122 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) |
| 124 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase, | 123 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase, |
| 125 OnIDBFactoryDeleteDatabase) | 124 OnIDBFactoryDeleteDatabase) |
| 126 IPC_MESSAGE_UNHANDLED(handled = false) | 125 IPC_MESSAGE_UNHANDLED(handled = false) |
| 127 IPC_END_MESSAGE_MAP() | 126 IPC_END_MESSAGE_MAP() |
| 128 } | 127 } |
| 129 return handled; | 128 return handled; |
| 130 } | 129 } |
| 131 | 130 |
| 132 int32 IndexedDBDispatcherHost::Add(WebIDBCursor* idb_cursor) { | 131 int32 IndexedDBDispatcherHost::Add(WebIDBCursorImpl* idb_cursor) { |
| 133 if (!cursor_dispatcher_host_) { | 132 if (!cursor_dispatcher_host_) { |
| 134 delete idb_cursor; | 133 delete idb_cursor; |
| 135 return 0; | 134 return 0; |
| 136 } | 135 } |
| 137 return cursor_dispatcher_host_->map_.Add(idb_cursor); | 136 return cursor_dispatcher_host_->map_.Add(idb_cursor); |
| 138 } | 137 } |
| 139 | 138 |
| 140 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database, | 139 int32 IndexedDBDispatcherHost::Add(WebIDBDatabaseImpl* idb_database, |
| 141 int32 ipc_thread_id, | 140 int32 ipc_thread_id, |
| 142 const GURL& origin_url) { | 141 const GURL& origin_url) { |
| 143 if (!database_dispatcher_host_) { | 142 if (!database_dispatcher_host_) { |
| 144 delete idb_database; | 143 delete idb_database; |
| 145 return 0; | 144 return 0; |
| 146 } | 145 } |
| 147 int32 ipc_database_id = database_dispatcher_host_->map_.Add(idb_database); | 146 int32 ipc_database_id = database_dispatcher_host_->map_.Add(idb_database); |
| 148 Context()->ConnectionOpened(origin_url, idb_database); | 147 Context()->ConnectionOpened(origin_url, idb_database); |
| 149 database_dispatcher_host_->database_url_map_[ipc_database_id] = origin_url; | 148 database_dispatcher_host_->database_url_map_[ipc_database_id] = origin_url; |
| 150 return ipc_database_id; | 149 return ipc_database_id; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 170 return transaction_id | (static_cast<uint64>(pid) << 32); | 169 return transaction_id | (static_cast<uint64>(pid) << 32); |
| 171 } | 170 } |
| 172 | 171 |
| 173 int64 IndexedDBDispatcherHost::RendererTransactionId( | 172 int64 IndexedDBDispatcherHost::RendererTransactionId( |
| 174 int64 host_transaction_id) { | 173 int64 host_transaction_id) { |
| 175 DCHECK(host_transaction_id >> 32 == base::GetProcId(peer_handle())) | 174 DCHECK(host_transaction_id >> 32 == base::GetProcId(peer_handle())) |
| 176 << "Invalid renderer target for transaction id"; | 175 << "Invalid renderer target for transaction id"; |
| 177 return host_transaction_id & 0xffffffff; | 176 return host_transaction_id & 0xffffffff; |
| 178 } | 177 } |
| 179 | 178 |
| 180 WebIDBCursor* IndexedDBDispatcherHost::GetCursorFromId(int32 ipc_cursor_id) { | 179 WebIDBCursorImpl* IndexedDBDispatcherHost::GetCursorFromId( |
| 180 int32 ipc_cursor_id) { |
| 181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 182 return cursor_dispatcher_host_->map_.Lookup(ipc_cursor_id); | 182 return cursor_dispatcher_host_->map_.Lookup(ipc_cursor_id); |
| 183 } | 183 } |
| 184 | 184 |
| 185 IndexedDBDatabaseMetadata IndexedDBDispatcherHost::ConvertMetadata( | 185 IndexedDBDatabaseMetadata IndexedDBDispatcherHost::ConvertMetadata( |
| 186 const WebIDBMetadata& web_metadata) { | 186 const WebIDBMetadata& web_metadata) { |
| 187 IndexedDBDatabaseMetadata metadata; | 187 IndexedDBDatabaseMetadata metadata; |
| 188 metadata.id = web_metadata.id; | 188 metadata.id = web_metadata.id; |
| 189 metadata.name = web_metadata.name; | 189 metadata.name = web_metadata.name; |
| 190 metadata.version = web_metadata.version; | 190 metadata.version = web_metadata.version; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 void IndexedDBDispatcherHost::DatabaseDispatcherHost::CloseAll() { | 342 void IndexedDBDispatcherHost::DatabaseDispatcherHost::CloseAll() { |
| 343 // Abort outstanding transactions started by connections in the associated | 343 // Abort outstanding transactions started by connections in the associated |
| 344 // front-end to unblock later transactions. This should only occur on unclean | 344 // front-end to unblock later transactions. This should only occur on unclean |
| 345 // (crash) or abrupt (process-kill) shutdowns. | 345 // (crash) or abrupt (process-kill) shutdowns. |
| 346 for (TransactionIDToDatabaseIDMap::iterator iter = | 346 for (TransactionIDToDatabaseIDMap::iterator iter = |
| 347 transaction_database_map_.begin(); | 347 transaction_database_map_.begin(); |
| 348 iter != transaction_database_map_.end();) { | 348 iter != transaction_database_map_.end();) { |
| 349 int64 transaction_id = iter->first; | 349 int64 transaction_id = iter->first; |
| 350 int32 ipc_database_id = iter->second; | 350 int32 ipc_database_id = iter->second; |
| 351 ++iter; | 351 ++iter; |
| 352 WebIDBDatabase* database = map_.Lookup(ipc_database_id); | 352 WebIDBDatabaseImpl* database = map_.Lookup(ipc_database_id); |
| 353 if (database) { | 353 if (database) { |
| 354 database->abort( | 354 database->abort( |
| 355 transaction_id, | 355 transaction_id, |
| 356 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError)); | 356 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError)); |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 DCHECK(transaction_database_map_.empty()); | 359 DCHECK(transaction_database_map_.empty()); |
| 360 | 360 |
| 361 for (WebIDBObjectIDToURLMap::iterator iter = database_url_map_.begin(); | 361 for (WebIDBObjectIDToURLMap::iterator iter = database_url_map_.begin(); |
| 362 iter != database_url_map_.end(); | 362 iter != database_url_map_.end(); |
| 363 iter++) { | 363 iter++) { |
| 364 WebIDBDatabase* database = map_.Lookup(iter->first); | 364 WebIDBDatabaseImpl* database = map_.Lookup(iter->first); |
| 365 if (database) { | 365 if (database) { |
| 366 database->close(); | 366 database->close(); |
| 367 parent_->Context()->ConnectionClosed(iter->second, database); | 367 parent_->Context()->ConnectionClosed(iter->second, database); |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( | 372 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( |
| 373 const IPC::Message& message, | 373 const IPC::Message& message, |
| 374 bool* msg_is_ok) { | 374 bool* msg_is_ok) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 402 } | 402 } |
| 403 | 403 |
| 404 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( | 404 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( |
| 405 IPC::Message* message) { | 405 IPC::Message* message) { |
| 406 parent_->Send(message); | 406 parent_->Send(message); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( | 409 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( |
| 410 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params) { | 410 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params) { |
| 411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 412 WebIDBDatabase* database = | 412 WebIDBDatabaseImpl* database = |
| 413 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 413 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 414 if (!database) | 414 if (!database) |
| 415 return; | 415 return; |
| 416 | 416 |
| 417 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 417 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
| 418 database->createObjectStore(host_transaction_id, | 418 database->createObjectStore(host_transaction_id, |
| 419 params.object_store_id, | 419 params.object_store_id, |
| 420 params.name, | 420 params.name, |
| 421 params.key_path, | 421 params.key_path, |
| 422 params.auto_increment); | 422 params.auto_increment); |
| 423 if (parent_->Context()->IsOverQuota( | 423 if (parent_->Context()->IsOverQuota( |
| 424 database_url_map_[params.ipc_database_id])) { | 424 database_url_map_[params.ipc_database_id])) { |
| 425 database->abort( | 425 database->abort( |
| 426 host_transaction_id, | 426 host_transaction_id, |
| 427 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionQuotaError)); | 427 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionQuotaError)); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| 431 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore( | 431 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore( |
| 432 int32 ipc_database_id, | 432 int32 ipc_database_id, |
| 433 int64 transaction_id, | 433 int64 transaction_id, |
| 434 int64 object_store_id) { | 434 int64 object_store_id) { |
| 435 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 435 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 436 WebIDBDatabase* database = | 436 WebIDBDatabaseImpl* database = |
| 437 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 437 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 438 if (!database) | 438 if (!database) |
| 439 return; | 439 return; |
| 440 | 440 |
| 441 database->deleteObjectStore(parent_->HostTransactionId(transaction_id), | 441 database->deleteObjectStore(parent_->HostTransactionId(transaction_id), |
| 442 object_store_id); | 442 object_store_id); |
| 443 } | 443 } |
| 444 | 444 |
| 445 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateTransaction( | 445 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateTransaction( |
| 446 const IndexedDBHostMsg_DatabaseCreateTransaction_Params& params) { | 446 const IndexedDBHostMsg_DatabaseCreateTransaction_Params& params) { |
| 447 WebIDBDatabase* database = | 447 WebIDBDatabaseImpl* database = |
| 448 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 448 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 449 if (!database) | 449 if (!database) |
| 450 return; | 450 return; |
| 451 | 451 |
| 452 WebVector<long long> object_stores(params.object_store_ids.size()); | 452 WebVector<long long> object_stores(params.object_store_ids.size()); |
| 453 for (size_t i = 0; i < params.object_store_ids.size(); ++i) | 453 for (size_t i = 0; i < params.object_store_ids.size(); ++i) |
| 454 object_stores[i] = params.object_store_ids[i]; | 454 object_stores[i] = params.object_store_ids[i]; |
| 455 | 455 |
| 456 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 456 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
| 457 | 457 |
| 458 database->createTransaction( | 458 database->createTransaction( |
| 459 host_transaction_id, | 459 host_transaction_id, |
| 460 new IndexedDBDatabaseCallbacks( | 460 new IndexedDBDatabaseCallbacks( |
| 461 parent_, params.ipc_thread_id, params.ipc_database_callbacks_id), | 461 parent_, params.ipc_thread_id, params.ipc_database_callbacks_id), |
| 462 object_stores, | 462 object_stores, |
| 463 params.mode); | 463 params.mode); |
| 464 transaction_database_map_[host_transaction_id] = params.ipc_database_id; | 464 transaction_database_map_[host_transaction_id] = params.ipc_database_id; |
| 465 parent_->RegisterTransactionId(host_transaction_id, | 465 parent_->RegisterTransactionId(host_transaction_id, |
| 466 database_url_map_[params.ipc_database_id]); | 466 database_url_map_[params.ipc_database_id]); |
| 467 } | 467 } |
| 468 | 468 |
| 469 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( | 469 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( |
| 470 int32 ipc_database_id) { | 470 int32 ipc_database_id) { |
| 471 WebIDBDatabase* database = | 471 WebIDBDatabaseImpl* database = |
| 472 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 472 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 473 if (!database) | 473 if (!database) |
| 474 return; | 474 return; |
| 475 database->close(); | 475 database->close(); |
| 476 } | 476 } |
| 477 | 477 |
| 478 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( | 478 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( |
| 479 int32 ipc_object_id) { | 479 int32 ipc_object_id) { |
| 480 WebIDBDatabase* database = map_.Lookup(ipc_object_id); | 480 WebIDBDatabaseImpl* database = map_.Lookup(ipc_object_id); |
| 481 parent_->Context() | 481 parent_->Context() |
| 482 ->ConnectionClosed(database_url_map_[ipc_object_id], database); | 482 ->ConnectionClosed(database_url_map_[ipc_object_id], database); |
| 483 database_url_map_.erase(ipc_object_id); | 483 database_url_map_.erase(ipc_object_id); |
| 484 parent_->DestroyObject(&map_, ipc_object_id); | 484 parent_->DestroyObject(&map_, ipc_object_id); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet( | 487 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet( |
| 488 const IndexedDBHostMsg_DatabaseGet_Params& params) { | 488 const IndexedDBHostMsg_DatabaseGet_Params& params) { |
| 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 490 WebIDBDatabase* database = | 490 WebIDBDatabaseImpl* database = |
| 491 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 491 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 492 if (!database) | 492 if (!database) |
| 493 return; | 493 return; |
| 494 | 494 |
| 495 scoped_ptr<WebIDBCallbacks> callbacks(new IndexedDBCallbacks<WebData>( | 495 scoped_ptr<IndexedDBCallbacksBase> callbacks(new IndexedDBCallbacks<WebData>( |
| 496 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 496 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 497 database->get(parent_->HostTransactionId(params.transaction_id), | 497 database->get(parent_->HostTransactionId(params.transaction_id), |
| 498 params.object_store_id, | 498 params.object_store_id, |
| 499 params.index_id, | 499 params.index_id, |
| 500 params.key_range, | 500 params.key_range, |
| 501 params.key_only, | 501 params.key_only, |
| 502 callbacks.release()); | 502 callbacks.release()); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut( | 505 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut( |
| 506 const IndexedDBHostMsg_DatabasePut_Params& params) { | 506 const IndexedDBHostMsg_DatabasePut_Params& params) { |
| 507 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 507 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 508 | 508 |
| 509 WebIDBDatabase* database = | 509 WebIDBDatabaseImpl* database = |
| 510 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 510 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 511 if (!database) | 511 if (!database) |
| 512 return; | 512 return; |
| 513 scoped_ptr<WebIDBCallbacks> callbacks(new IndexedDBCallbacks<WebIDBKey>( | 513 scoped_ptr<IndexedDBCallbacksBase> callbacks( |
| 514 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 514 new IndexedDBCallbacks<WebIDBKey>( |
| 515 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 515 // Be careful with empty vectors. | 516 // Be careful with empty vectors. |
| 516 WebData value; | 517 WebData value; |
| 517 if (params.value.size()) | 518 if (params.value.size()) |
| 518 value.assign(¶ms.value.front(), params.value.size()); | 519 value.assign(¶ms.value.front(), params.value.size()); |
| 519 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 520 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
| 520 database->put(host_transaction_id, | 521 database->put(host_transaction_id, |
| 521 params.object_store_id, | 522 params.object_store_id, |
| 522 value, | 523 value, |
| 523 params.key, | 524 params.key, |
| 524 params.put_mode, | 525 params.put_mode, |
| 525 callbacks.release(), | 526 callbacks.release(), |
| 526 params.index_ids, | 527 params.index_ids, |
| 527 params.index_keys); | 528 params.index_keys); |
| 528 TransactionIDToSizeMap* map = | 529 TransactionIDToSizeMap* map = |
| 529 &parent_->database_dispatcher_host_->transaction_size_map_; | 530 &parent_->database_dispatcher_host_->transaction_size_map_; |
| 530 // Size can't be big enough to overflow because it represents the | 531 // Size can't be big enough to overflow because it represents the |
| 531 // actual bytes passed through IPC. | 532 // actual bytes passed through IPC. |
| 532 (*map)[host_transaction_id] += params.value.size(); | 533 (*map)[host_transaction_id] += params.value.size(); |
| 533 } | 534 } |
| 534 | 535 |
| 535 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexKeys( | 536 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexKeys( |
| 536 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params) { | 537 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params) { |
| 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 538 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 538 WebIDBDatabase* database = | 539 WebIDBDatabaseImpl* database = |
| 539 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 540 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 540 if (!database) | 541 if (!database) |
| 541 return; | 542 return; |
| 542 | 543 |
| 543 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 544 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
| 544 if (params.index_ids.size() != params.index_keys.size()) { | 545 if (params.index_ids.size() != params.index_keys.size()) { |
| 545 database->abort( | 546 database->abort( |
| 546 host_transaction_id, | 547 host_transaction_id, |
| 547 WebIDBDatabaseError( | 548 WebIDBDatabaseError( |
| 548 WebKit::WebIDBDatabaseExceptionUnknownError, | 549 WebKit::WebIDBDatabaseExceptionUnknownError, |
| 549 "Malformed IPC message: index_ids.size() != index_keys.size()")); | 550 "Malformed IPC message: index_ids.size() != index_keys.size()")); |
| 550 return; | 551 return; |
| 551 } | 552 } |
| 552 | 553 |
| 553 database->setIndexKeys(host_transaction_id, | 554 database->setIndexKeys(host_transaction_id, |
| 554 params.object_store_id, | 555 params.object_store_id, |
| 555 params.primary_key, | 556 params.primary_key, |
| 556 params.index_ids, | 557 params.index_ids, |
| 557 params.index_keys); | 558 params.index_keys); |
| 558 } | 559 } |
| 559 | 560 |
| 560 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexesReady( | 561 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexesReady( |
| 561 int32 ipc_database_id, | 562 int32 ipc_database_id, |
| 562 int64 transaction_id, | 563 int64 transaction_id, |
| 563 int64 object_store_id, | 564 int64 object_store_id, |
| 564 const std::vector<int64>& index_ids) { | 565 const std::vector<int64>& index_ids) { |
| 565 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 566 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 566 WebIDBDatabase* database = | 567 WebIDBDatabaseImpl* database = |
| 567 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 568 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 568 if (!database) | 569 if (!database) |
| 569 return; | 570 return; |
| 570 | 571 |
| 571 database->setIndexesReady(parent_->HostTransactionId(transaction_id), | 572 database->setIndexesReady(parent_->HostTransactionId(transaction_id), |
| 572 object_store_id, | 573 object_store_id, |
| 573 WebVector<long long>(index_ids)); | 574 WebVector<long long>(index_ids)); |
| 574 } | 575 } |
| 575 | 576 |
| 576 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpenCursor( | 577 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpenCursor( |
| 577 const IndexedDBHostMsg_DatabaseOpenCursor_Params& params) { | 578 const IndexedDBHostMsg_DatabaseOpenCursor_Params& params) { |
| 578 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 579 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 579 WebIDBDatabase* database = | 580 WebIDBDatabaseImpl* database = |
| 580 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 581 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 581 if (!database) | 582 if (!database) |
| 582 return; | 583 return; |
| 583 | 584 |
| 584 scoped_ptr<WebIDBCallbacks> callbacks(new IndexedDBCallbacks<WebIDBCursor>( | 585 scoped_ptr<IndexedDBCallbacksBase> callbacks( |
| 585 parent_, params.ipc_thread_id, params.ipc_callbacks_id, -1)); | 586 new IndexedDBCallbacks<WebIDBCursorImpl>( |
| 587 parent_, params.ipc_thread_id, params.ipc_callbacks_id, -1)); |
| 586 database->openCursor(parent_->HostTransactionId(params.transaction_id), | 588 database->openCursor(parent_->HostTransactionId(params.transaction_id), |
| 587 params.object_store_id, | 589 params.object_store_id, |
| 588 params.index_id, | 590 params.index_id, |
| 589 params.key_range, | 591 params.key_range, |
| 590 params.direction, | 592 params.direction, |
| 591 params.key_only, | 593 params.key_only, |
| 592 params.task_type, | 594 params.task_type, |
| 593 callbacks.release()); | 595 callbacks.release()); |
| 594 } | 596 } |
| 595 | 597 |
| 596 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCount( | 598 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCount( |
| 597 const IndexedDBHostMsg_DatabaseCount_Params& params) { | 599 const IndexedDBHostMsg_DatabaseCount_Params& params) { |
| 598 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 600 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 599 WebIDBDatabase* database = | 601 WebIDBDatabaseImpl* database = |
| 600 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 602 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 601 if (!database) | 603 if (!database) |
| 602 return; | 604 return; |
| 603 | 605 |
| 604 scoped_ptr<WebIDBCallbacks> callbacks(new IndexedDBCallbacks<WebData>( | 606 scoped_ptr<IndexedDBCallbacksBase> callbacks(new IndexedDBCallbacks<WebData>( |
| 605 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 607 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 606 database->count(parent_->HostTransactionId(params.transaction_id), | 608 database->count(parent_->HostTransactionId(params.transaction_id), |
| 607 params.object_store_id, | 609 params.object_store_id, |
| 608 params.index_id, | 610 params.index_id, |
| 609 params.key_range, | 611 params.key_range, |
| 610 callbacks.release()); | 612 callbacks.release()); |
| 611 } | 613 } |
| 612 | 614 |
| 613 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteRange( | 615 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteRange( |
| 614 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params) { | 616 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params) { |
| 615 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 616 WebIDBDatabase* database = | 618 WebIDBDatabaseImpl* database = |
| 617 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 619 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 618 if (!database) | 620 if (!database) |
| 619 return; | 621 return; |
| 620 | 622 |
| 621 scoped_ptr<WebIDBCallbacks> callbacks(new IndexedDBCallbacks<WebData>( | 623 scoped_ptr<IndexedDBCallbacksBase> callbacks(new IndexedDBCallbacks<WebData>( |
| 622 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 624 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 623 database->deleteRange(parent_->HostTransactionId(params.transaction_id), | 625 database->deleteRange(parent_->HostTransactionId(params.transaction_id), |
| 624 params.object_store_id, | 626 params.object_store_id, |
| 625 params.key_range, | 627 params.key_range, |
| 626 callbacks.release()); | 628 callbacks.release()); |
| 627 } | 629 } |
| 628 | 630 |
| 629 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClear( | 631 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClear( |
| 630 int32 ipc_thread_id, | 632 int32 ipc_thread_id, |
| 631 int32 ipc_callbacks_id, | 633 int32 ipc_callbacks_id, |
| 632 int32 ipc_database_id, | 634 int32 ipc_database_id, |
| 633 int64 transaction_id, | 635 int64 transaction_id, |
| 634 int64 object_store_id) { | 636 int64 object_store_id) { |
| 635 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 637 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 636 WebIDBDatabase* database = | 638 WebIDBDatabaseImpl* database = |
| 637 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 639 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 638 if (!database) | 640 if (!database) |
| 639 return; | 641 return; |
| 640 | 642 |
| 641 scoped_ptr<WebIDBCallbacks> callbacks(new IndexedDBCallbacks<WebData>( | 643 scoped_ptr<IndexedDBCallbacksBase> callbacks(new IndexedDBCallbacks<WebData>( |
| 642 parent_, ipc_thread_id, ipc_callbacks_id)); | 644 parent_, ipc_thread_id, ipc_callbacks_id)); |
| 643 | 645 |
| 644 database->clear(parent_->HostTransactionId(transaction_id), | 646 database->clear(parent_->HostTransactionId(transaction_id), |
| 645 object_store_id, | 647 object_store_id, |
| 646 callbacks.release()); | 648 callbacks.release()); |
| 647 } | 649 } |
| 648 | 650 |
| 649 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnAbort( | 651 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnAbort( |
| 650 int32 ipc_database_id, | 652 int32 ipc_database_id, |
| 651 int64 transaction_id) { | 653 int64 transaction_id) { |
| 652 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 654 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 653 WebIDBDatabase* database = | 655 WebIDBDatabaseImpl* database = |
| 654 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 656 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 655 if (!database) | 657 if (!database) |
| 656 return; | 658 return; |
| 657 | 659 |
| 658 database->abort(parent_->HostTransactionId(transaction_id)); | 660 database->abort(parent_->HostTransactionId(transaction_id)); |
| 659 } | 661 } |
| 660 | 662 |
| 661 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCommit( | 663 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCommit( |
| 662 int32 ipc_database_id, | 664 int32 ipc_database_id, |
| 663 int64 transaction_id) { | 665 int64 transaction_id) { |
| 664 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 666 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 665 WebIDBDatabase* database = | 667 WebIDBDatabaseImpl* database = |
| 666 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 668 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 667 if (!database) | 669 if (!database) |
| 668 return; | 670 return; |
| 669 | 671 |
| 670 int64 host_transaction_id = parent_->HostTransactionId(transaction_id); | 672 int64 host_transaction_id = parent_->HostTransactionId(transaction_id); |
| 671 int64 transaction_size = transaction_size_map_[host_transaction_id]; | 673 int64 transaction_size = transaction_size_map_[host_transaction_id]; |
| 672 if (transaction_size && | 674 if (transaction_size && |
| 673 parent_->Context()->WouldBeOverQuota( | 675 parent_->Context()->WouldBeOverQuota( |
| 674 transaction_url_map_[host_transaction_id], transaction_size)) { | 676 transaction_url_map_[host_transaction_id], transaction_size)) { |
| 675 database->abort( | 677 database->abort( |
| 676 host_transaction_id, | 678 host_transaction_id, |
| 677 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionQuotaError)); | 679 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionQuotaError)); |
| 678 return; | 680 return; |
| 679 } | 681 } |
| 680 | 682 |
| 681 database->commit(host_transaction_id); | 683 database->commit(host_transaction_id); |
| 682 } | 684 } |
| 683 | 685 |
| 684 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateIndex( | 686 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateIndex( |
| 685 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params) { | 687 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params) { |
| 686 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 688 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 687 WebIDBDatabase* database = | 689 WebIDBDatabaseImpl* database = |
| 688 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 690 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 689 if (!database) | 691 if (!database) |
| 690 return; | 692 return; |
| 691 | 693 |
| 692 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 694 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
| 693 database->createIndex(host_transaction_id, | 695 database->createIndex(host_transaction_id, |
| 694 params.object_store_id, | 696 params.object_store_id, |
| 695 params.index_id, | 697 params.index_id, |
| 696 params.name, | 698 params.name, |
| 697 params.key_path, | 699 params.key_path, |
| 698 params.unique, | 700 params.unique, |
| 699 params.multi_entry); | 701 params.multi_entry); |
| 700 if (parent_->Context()->IsOverQuota( | 702 if (parent_->Context()->IsOverQuota( |
| 701 database_url_map_[params.ipc_database_id])) { | 703 database_url_map_[params.ipc_database_id])) { |
| 702 database->abort( | 704 database->abort( |
| 703 host_transaction_id, | 705 host_transaction_id, |
| 704 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionQuotaError)); | 706 WebIDBDatabaseError(WebKit::WebIDBDatabaseExceptionQuotaError)); |
| 705 } | 707 } |
| 706 } | 708 } |
| 707 | 709 |
| 708 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteIndex( | 710 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteIndex( |
| 709 int32 ipc_database_id, | 711 int32 ipc_database_id, |
| 710 int64 transaction_id, | 712 int64 transaction_id, |
| 711 int64 object_store_id, | 713 int64 object_store_id, |
| 712 int64 index_id) { | 714 int64 index_id) { |
| 713 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 715 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 714 WebIDBDatabase* database = | 716 WebIDBDatabaseImpl* database = |
| 715 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 717 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 716 if (!database) | 718 if (!database) |
| 717 return; | 719 return; |
| 718 | 720 |
| 719 database->deleteIndex( | 721 database->deleteIndex( |
| 720 parent_->HostTransactionId(transaction_id), object_store_id, index_id); | 722 parent_->HostTransactionId(transaction_id), object_store_id, index_id); |
| 721 } | 723 } |
| 722 | 724 |
| 723 ////////////////////////////////////////////////////////////////////// | 725 ////////////////////////////////////////////////////////////////////// |
| 724 // IndexedDBDispatcherHost::CursorDispatcherHost | 726 // IndexedDBDispatcherHost::CursorDispatcherHost |
| (...skipping 27 matching lines...) Expand all Loading... |
| 752 IPC::Message* message) { | 754 IPC::Message* message) { |
| 753 parent_->Send(message); | 755 parent_->Send(message); |
| 754 } | 756 } |
| 755 | 757 |
| 756 void IndexedDBDispatcherHost::CursorDispatcherHost::OnAdvance( | 758 void IndexedDBDispatcherHost::CursorDispatcherHost::OnAdvance( |
| 757 int32 ipc_cursor_id, | 759 int32 ipc_cursor_id, |
| 758 int32 ipc_thread_id, | 760 int32 ipc_thread_id, |
| 759 int32 ipc_callbacks_id, | 761 int32 ipc_callbacks_id, |
| 760 unsigned long count) { | 762 unsigned long count) { |
| 761 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 763 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 762 WebIDBCursor* idb_cursor = | 764 WebIDBCursorImpl* idb_cursor = |
| 763 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 765 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 764 if (!idb_cursor) | 766 if (!idb_cursor) |
| 765 return; | 767 return; |
| 766 | 768 |
| 767 idb_cursor->advance( | 769 idb_cursor->advance( |
| 768 count, | 770 count, |
| 769 new IndexedDBCallbacks<WebIDBCursor>( | 771 new IndexedDBCallbacks<WebIDBCursorImpl>( |
| 770 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); | 772 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); |
| 771 } | 773 } |
| 772 | 774 |
| 773 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( | 775 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( |
| 774 int32 ipc_cursor_id, | 776 int32 ipc_cursor_id, |
| 775 int32 ipc_thread_id, | 777 int32 ipc_thread_id, |
| 776 int32 ipc_callbacks_id, | 778 int32 ipc_callbacks_id, |
| 777 const IndexedDBKey& key) { | 779 const IndexedDBKey& key) { |
| 778 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 780 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 779 WebIDBCursor* idb_cursor = | 781 WebIDBCursorImpl* idb_cursor = |
| 780 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 782 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 781 if (!idb_cursor) | 783 if (!idb_cursor) |
| 782 return; | 784 return; |
| 783 | 785 |
| 784 idb_cursor->continueFunction( | 786 idb_cursor->continueFunction( |
| 785 key, | 787 key, |
| 786 new IndexedDBCallbacks<WebIDBCursor>( | 788 new IndexedDBCallbacks<WebIDBCursorImpl>( |
| 787 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); | 789 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); |
| 788 } | 790 } |
| 789 | 791 |
| 790 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( | 792 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( |
| 791 int32 ipc_cursor_id, | 793 int32 ipc_cursor_id, |
| 792 int32 ipc_thread_id, | 794 int32 ipc_thread_id, |
| 793 int32 ipc_callbacks_id, | 795 int32 ipc_callbacks_id, |
| 794 int n) { | 796 int n) { |
| 795 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 797 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 796 WebIDBCursor* idb_cursor = | 798 WebIDBCursorImpl* idb_cursor = |
| 797 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 799 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 798 if (!idb_cursor) | 800 if (!idb_cursor) |
| 799 return; | 801 return; |
| 800 | 802 |
| 801 idb_cursor->prefetchContinue( | 803 idb_cursor->prefetchContinue( |
| 802 n, | 804 n, |
| 803 new IndexedDBCallbacks<WebIDBCursor>( | 805 new IndexedDBCallbacks<WebIDBCursorImpl>( |
| 804 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); | 806 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); |
| 805 } | 807 } |
| 806 | 808 |
| 807 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( | 809 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( |
| 808 int32 ipc_cursor_id, | 810 int32 ipc_cursor_id, |
| 809 int used_prefetches, | 811 int used_prefetches, |
| 810 int unused_prefetches) { | 812 int unused_prefetches) { |
| 811 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 813 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 812 WebIDBCursor* idb_cursor = | 814 WebIDBCursorImpl* idb_cursor = |
| 813 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 815 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 814 if (!idb_cursor) | 816 if (!idb_cursor) |
| 815 return; | 817 return; |
| 816 | 818 |
| 817 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); | 819 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); |
| 818 } | 820 } |
| 819 | 821 |
| 820 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 822 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
| 821 int32 ipc_object_id) { | 823 int32 ipc_object_id) { |
| 822 parent_->DestroyObject(&map_, ipc_object_id); | 824 parent_->DestroyObject(&map_, ipc_object_id); |
| 823 } | 825 } |
| 824 | 826 |
| 825 } // namespace content | 827 } // namespace content |
| OLD | NEW |