Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
| 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" | 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 return cursor_dispatcher_host_->map_.Add(idb_cursor); | 148 return cursor_dispatcher_host_->map_.Add(idb_cursor); |
| 149 } | 149 } |
| 150 | 150 |
| 151 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database, | 151 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database, |
| 152 const GURL& origin_url) { | 152 const GURL& origin_url) { |
| 153 if (!database_dispatcher_host_.get()) { | 153 if (!database_dispatcher_host_.get()) { |
| 154 delete idb_database; | 154 delete idb_database; |
| 155 return 0; | 155 return 0; |
| 156 } | 156 } |
| 157 int32 idb_database_id = database_dispatcher_host_->map_.Add(idb_database); | 157 int32 idb_database_id = database_dispatcher_host_->map_.Add(idb_database); |
| 158 database_dispatcher_host_->url_map_[idb_database_id] = origin_url; | 158 database_dispatcher_host_->database_url_map_[idb_database_id] = origin_url; |
| 159 return idb_database_id; | 159 return idb_database_id; |
| 160 } | 160 } |
| 161 | 161 |
| 162 int32 IndexedDBDispatcherHost::Add(WebIDBIndex* idb_index) { | 162 int32 IndexedDBDispatcherHost::Add(WebIDBIndex* idb_index) { |
| 163 if (!index_dispatcher_host_.get()) { | 163 if (!index_dispatcher_host_.get()) { |
| 164 delete idb_index; | 164 delete idb_index; |
| 165 return 0; | 165 return 0; |
| 166 } | 166 } |
| 167 if (!idb_index) | 167 if (!idb_index) |
| 168 return 0; | 168 return 0; |
| 169 return index_dispatcher_host_->map_.Add(idb_index); | 169 return index_dispatcher_host_->map_.Add(idb_index); |
| 170 } | 170 } |
| 171 | 171 |
| 172 int32 IndexedDBDispatcherHost::Add(WebIDBObjectStore* idb_object_store) { | 172 int32 IndexedDBDispatcherHost::Add(WebIDBObjectStore* idb_object_store) { |
| 173 if (!object_store_dispatcher_host_.get()) { | 173 if (!object_store_dispatcher_host_.get()) { |
| 174 delete idb_object_store; | 174 delete idb_object_store; |
| 175 return 0; | 175 return 0; |
| 176 } | 176 } |
| 177 if (!idb_object_store) | 177 if (!idb_object_store) |
| 178 return 0; | 178 return 0; |
| 179 return object_store_dispatcher_host_->map_.Add(idb_object_store); | 179 return object_store_dispatcher_host_->map_.Add(idb_object_store); |
| 180 } | 180 } |
| 181 | 181 |
| 182 int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction) { | 182 int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction, |
| 183 const GURL& url) { | |
| 183 if (!transaction_dispatcher_host_.get()) { | 184 if (!transaction_dispatcher_host_.get()) { |
| 184 delete idb_transaction; | 185 delete idb_transaction; |
| 185 return 0; | 186 return 0; |
| 186 } | 187 } |
| 187 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction); | 188 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction); |
| 188 idb_transaction->setCallbacks(new IndexedDBTransactionCallbacks(this, id)); | 189 idb_transaction->setCallbacks(new IndexedDBTransactionCallbacks(this, id)); |
| 190 transaction_dispatcher_host_->transaction_url_map_[id] = url; | |
| 189 return id; | 191 return id; |
| 190 } | 192 } |
| 191 | 193 |
| 192 void IndexedDBDispatcherHost::OnIDBFactoryOpen( | 194 void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
| 193 const IndexedDBHostMsg_FactoryOpen_Params& params) { | 195 const IndexedDBHostMsg_FactoryOpen_Params& params) { |
| 196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | |
| 194 FilePath base_path = webkit_context_->data_path(); | 197 FilePath base_path = webkit_context_->data_path(); |
| 195 FilePath indexed_db_path; | 198 FilePath indexed_db_path; |
| 196 if (!base_path.empty()) { | 199 if (!base_path.empty()) { |
| 197 indexed_db_path = base_path.Append( | 200 indexed_db_path = base_path.Append( |
| 198 IndexedDBContext::kIndexedDBDirectory); | 201 IndexedDBContext::kIndexedDBDirectory); |
| 199 } | 202 } |
| 200 | 203 |
| 201 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need | 204 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need |
|
michaeln
2011/07/27 01:31:35
see DatabaseUtil::GetOriginFromIdentifier
dgrogan
2011/07/29 18:14:04
Thanks. I'll fix it in another CL.
| |
| 202 // to add some toString method to WebSecurityOrigin that doesn't | 205 // to add some toString method to WebSecurityOrigin that doesn't |
| 203 // return null for them. | 206 // return null for them. |
| 204 WebSecurityOrigin origin( | 207 WebSecurityOrigin origin( |
| 205 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | 208 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); |
| 206 GURL origin_url(origin.toString()); | 209 GURL origin_url(origin.toString()); |
| 207 | 210 |
| 208 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 209 DCHECK(kDefaultQuota == params.maximum_size); | 212 DCHECK(kDefaultQuota == params.maximum_size); |
| 210 | 213 |
| 211 uint64 quota = kDefaultQuota; | 214 uint64 quota = kDefaultQuota; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 GURL url(origin.toString()); | 251 GURL url(origin.toString()); |
| 249 | 252 |
| 250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 253 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 251 Context()->GetIDBFactory()->deleteDatabase( | 254 Context()->GetIDBFactory()->deleteDatabase( |
| 252 params.name, | 255 params.name, |
| 253 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id, url), | 256 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id, url), |
| 254 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, | 257 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, |
| 255 webkit_glue::FilePathToWebString(indexed_db_path)); | 258 webkit_glue::FilePathToWebString(indexed_db_path)); |
| 256 } | 259 } |
| 257 | 260 |
| 261 void IndexedDBDispatcherHost::TransactionComplete(int32 transaction_id) { | |
| 262 int bytes_used = | |
| 263 transaction_dispatcher_host_->transaction_size_map_[transaction_id]; | |
| 264 if (bytes_used) | |
| 265 Context()->quota_manager_proxy()->NotifyStorageModified( | |
| 266 quota::QuotaClient::kIndexedDatabase, | |
| 267 transaction_dispatcher_host_->transaction_url_map_[transaction_id], | |
| 268 quota::kStorageTypeTemporary, | |
| 269 bytes_used); | |
| 270 transaction_dispatcher_host_->transaction_size_map_.erase(transaction_id); | |
| 271 } | |
| 272 | |
| 258 ////////////////////////////////////////////////////////////////////// | 273 ////////////////////////////////////////////////////////////////////// |
| 259 // Helper templates. | 274 // Helper templates. |
| 260 // | 275 // |
| 261 | 276 |
| 262 template <typename ObjectType> | 277 template <typename ObjectType> |
| 263 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( | 278 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( |
| 264 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { | 279 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { |
| 265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 266 ObjectType* return_object = map->Lookup(return_object_id); | 281 ObjectType* return_object = map->Lookup(return_object_id); |
| 267 if (!return_object) { | 282 if (!return_object) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 WebKit::WebExceptionCode* ec) { | 412 WebKit::WebExceptionCode* ec) { |
| 398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 413 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 399 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( | 414 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( |
| 400 &map_, idb_database_id); | 415 &map_, idb_database_id); |
| 401 if (!idb_database) | 416 if (!idb_database) |
| 402 return; | 417 return; |
| 403 | 418 |
| 404 *ec = 0; | 419 *ec = 0; |
| 405 idb_database->setVersion( | 420 idb_database->setVersion( |
| 406 version, | 421 version, |
| 407 new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id), | 422 new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id, |
| 423 database_url_map_[idb_database_id]), | |
| 408 *ec); | 424 *ec); |
| 409 } | 425 } |
| 410 | 426 |
| 411 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( | 427 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( |
| 412 int32 idb_database_id, | 428 int32 idb_database_id, |
| 413 const std::vector<string16>& names, | 429 const std::vector<string16>& names, |
| 414 int32 mode, | 430 int32 mode, |
| 415 int32 timeout, | 431 int32 timeout, |
| 416 int32* idb_transaction_id, | 432 int32* idb_transaction_id, |
| 417 WebKit::WebExceptionCode* ec) { | 433 WebKit::WebExceptionCode* ec) { |
| 418 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | 434 WebIDBDatabase* database = parent_->GetOrTerminateProcess( |
| 419 &map_, idb_database_id); | 435 &map_, idb_database_id); |
| 420 if (!database) | 436 if (!database) |
| 421 return; | 437 return; |
| 422 | 438 |
| 423 WebDOMStringList object_stores; | 439 WebDOMStringList object_stores; |
| 424 for (std::vector<string16>::const_iterator it = names.begin(); | 440 for (std::vector<string16>::const_iterator it = names.begin(); |
| 425 it != names.end(); ++it) { | 441 it != names.end(); ++it) { |
| 426 object_stores.append(*it); | 442 object_stores.append(*it); |
| 427 } | 443 } |
| 428 | 444 |
| 429 *ec = 0; | 445 *ec = 0; |
| 430 WebIDBTransaction* transaction = database->transaction( | 446 WebIDBTransaction* transaction = database->transaction( |
| 431 object_stores, mode, timeout, *ec); | 447 object_stores, mode, timeout, *ec); |
| 432 DCHECK(!transaction != !*ec); | 448 DCHECK(!transaction != !*ec); |
| 433 *idb_transaction_id = *ec ? 0 : parent_->Add(transaction); | 449 *idb_transaction_id = |
| 450 *ec ? 0 : parent_->Add(transaction, database_url_map_[idb_database_id]); | |
| 434 } | 451 } |
| 435 | 452 |
| 436 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( | 453 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( |
| 437 int32 idb_database_id, int32 response_id) { | 454 int32 idb_database_id, int32 response_id) { |
| 438 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | 455 WebIDBDatabase* database = parent_->GetOrTerminateProcess( |
| 439 &map_, idb_database_id); | 456 &map_, idb_database_id); |
| 440 database->open(new IndexedDBDatabaseCallbacks(parent_, response_id)); | 457 database->open(new IndexedDBDatabaseCallbacks(parent_, response_id)); |
| 441 } | 458 } |
| 442 | 459 |
| 443 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( | 460 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( |
| 444 int32 idb_database_id) { | 461 int32 idb_database_id) { |
| 445 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | 462 WebIDBDatabase* database = parent_->GetOrTerminateProcess( |
| 446 &map_, idb_database_id); | 463 &map_, idb_database_id); |
| 447 database->close(); | 464 database->close(); |
| 448 parent_->Context()->quota_manager_proxy()->NotifyStorageAccessed( | 465 parent_->Context()->quota_manager_proxy()->NotifyStorageAccessed( |
| 449 quota::QuotaClient::kIndexedDatabase, url_map_[idb_database_id], | 466 quota::QuotaClient::kIndexedDatabase, database_url_map_[idb_database_id], |
| 450 quota::kStorageTypeTemporary); | 467 quota::kStorageTypeTemporary); |
| 451 url_map_.erase(idb_database_id); | 468 database_url_map_.erase(idb_database_id); |
| 452 } | 469 } |
| 453 | 470 |
| 454 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( | 471 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( |
| 455 int32 object_id) { | 472 int32 object_id) { |
| 456 parent_->DestroyObject(&map_, object_id); | 473 parent_->DestroyObject(&map_, object_id); |
| 457 } | 474 } |
| 458 | 475 |
| 459 | 476 |
| 460 ////////////////////////////////////////////////////////////////////// | 477 ////////////////////////////////////////////////////////////////////// |
| 461 // IndexedDBDispatcherHost::IndexDispatcherHost | 478 // IndexedDBDispatcherHost::IndexDispatcherHost |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 &parent_->transaction_dispatcher_host_->map_, transaction_id); | 698 &parent_->transaction_dispatcher_host_->map_, transaction_id); |
| 682 if (!idb_transaction || !idb_object_store) | 699 if (!idb_transaction || !idb_object_store) |
| 683 return; | 700 return; |
| 684 | 701 |
| 685 *ec = 0; | 702 *ec = 0; |
| 686 scoped_ptr<WebIDBCallbacks> callbacks( | 703 scoped_ptr<WebIDBCallbacks> callbacks( |
| 687 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); | 704 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); |
| 688 idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec); | 705 idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec); |
| 689 } | 706 } |
| 690 | 707 |
| 708 static void AbortTransaction(WebIDBTransaction* idb_transaction) { | |
| 709 idb_transaction->abort(); | |
|
michaeln
2011/07/27 01:31:35
could idb_transaction have been deleted prior to t
| |
| 710 } | |
| 711 | |
| 712 static void DidCompleteTaskEvents(WebIDBTransaction* idb_transaction) { | |
| 713 idb_transaction->didCompleteTaskEvents(); | |
| 714 } | |
| 715 | |
| 716 class IndexedDBGetUsageAndQuotaCallback : | |
| 717 public quota::QuotaManager::GetUsageAndQuotaCallback { | |
| 718 public: | |
| 719 IndexedDBGetUsageAndQuotaCallback(int64 size, | |
| 720 WebIDBTransaction* idb_transaction) | |
| 721 : size_(size), | |
| 722 idb_transaction_(idb_transaction) { | |
|
michaeln
2011/07/27 01:31:35
nit: indent is off
| |
| 723 } | |
| 724 | |
| 725 void Run(quota::QuotaStatusCode status, int64 usage, int64 quota) { | |
| 726 if (size_ > (quota - usage)) { | |
| 727 BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, | |
| 728 NewRunnableFunction(&AbortTransaction, idb_transaction_)); | |
| 729 } else { | |
| 730 BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, | |
| 731 NewRunnableFunction(&DidCompleteTaskEvents, idb_transaction_)); | |
| 732 } | |
| 733 } | |
| 734 | |
| 735 virtual void RunWithParams( | |
| 736 const Tuple3<quota::QuotaStatusCode, int64, int64>& params) { | |
| 737 Run(params.a, params.b, params.c); | |
| 738 } | |
| 739 | |
| 740 private: | |
| 741 int64 size_; | |
| 742 WebIDBTransaction* idb_transaction_; | |
| 743 }; | |
| 744 | |
| 745 static void RequestQuota( | |
| 746 scoped_refptr<quota::QuotaManagerProxy> proxy, const GURL& gurl, | |
| 747 IndexedDBGetUsageAndQuotaCallback* idb_quota_callback) { | |
| 748 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 749 proxy->quota_manager()->GetUsageAndQuota( | |
| 750 gurl, | |
| 751 quota::kStorageTypeTemporary, | |
| 752 idb_quota_callback); | |
| 753 } | |
| 754 | |
| 691 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( | 755 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( |
| 692 const IndexedDBHostMsg_ObjectStorePut_Params& params, | 756 const IndexedDBHostMsg_ObjectStorePut_Params& params, |
| 693 WebKit::WebExceptionCode* ec) { | 757 WebKit::WebExceptionCode* ec) { |
| 694 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 758 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 695 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( | 759 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
| 696 &map_, params.idb_object_store_id); | 760 &map_, params.idb_object_store_id); |
| 697 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 761 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 698 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); | 762 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); |
| 699 if (!idb_transaction || !idb_object_store) | 763 if (!idb_transaction || !idb_object_store) |
| 700 return; | 764 return; |
| 701 | 765 |
| 702 *ec = 0; | 766 *ec = 0; |
| 703 scoped_ptr<WebIDBCallbacks> callbacks( | 767 scoped_ptr<WebIDBCallbacks> callbacks( |
| 704 new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id)); | 768 new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id)); |
| 769 | |
| 705 idb_object_store->put(params.serialized_value, params.key, params.put_mode, | 770 idb_object_store->put(params.serialized_value, params.key, params.put_mode, |
| 706 callbacks.release(), *idb_transaction, *ec); | 771 callbacks.release(), *idb_transaction, *ec); |
| 772 if (*ec) | |
| 773 return; | |
| 774 // TODO(dgrogan): Count key size too. | |
| 775 // TODO(dgrogan): Figure out how accurate this is in terms of disk space used. | |
|
michaeln
2011/07/27 01:31:35
Eavesdropping on OnPut/OnDelete/OnClear/OnIndex/On
dgrogan
2011/07/27 22:56:01
Your concerns are valid. The issue is that LevelD
dgrogan
2011/07/29 18:14:04
So, I realized that's not how the quota manager wo
| |
| 776 int64 size = UTF16ToUTF8(params.serialized_value.data()).size(); | |
| 777 WebIDBTransactionIDToSizeMap* map = | |
| 778 &parent_->transaction_dispatcher_host_->transaction_size_map_; | |
| 779 (*map)[params.transaction_id] += size; | |
| 707 } | 780 } |
| 708 | 781 |
| 709 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete( | 782 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete( |
| 710 int idb_object_store_id, | 783 int idb_object_store_id, |
| 711 int32 response_id, | 784 int32 response_id, |
| 712 const IndexedDBKey& key, | 785 const IndexedDBKey& key, |
| 713 int32 transaction_id, | 786 int32 transaction_id, |
| 714 WebKit::WebExceptionCode* ec) { | 787 WebKit::WebExceptionCode* ec) { |
| 715 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 788 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 716 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( | 789 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1014 | 1087 |
| 1015 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore( | 1088 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore( |
| 1016 int32 transaction_id, const string16& name, int32* object_store_id, | 1089 int32 transaction_id, const string16& name, int32* object_store_id, |
| 1017 WebKit::WebExceptionCode* ec) { | 1090 WebKit::WebExceptionCode* ec) { |
| 1018 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 1091 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 1019 &map_, transaction_id); | 1092 &map_, transaction_id); |
| 1020 if (!idb_transaction) | 1093 if (!idb_transaction) |
| 1021 return; | 1094 return; |
| 1022 | 1095 |
| 1023 *ec = 0; | 1096 *ec = 0; |
| 1024 WebIDBObjectStore* object_store = idb_transaction->objectStore(name, *ec); | 1097 WebIDBObjectStore* object_store = idb_transaction->objectStore(name, *ec); |
|
michaeln
2011/07/27 01:31:35
this looks like a mutation too
| |
| 1025 *object_store_id = object_store ? parent_->Add(object_store) : 0; | 1098 *object_store_id = object_store ? parent_->Add(object_store) : 0; |
| 1026 } | 1099 } |
| 1027 | 1100 |
| 1028 void IndexedDBDispatcherHost:: | 1101 void IndexedDBDispatcherHost:: |
| 1029 TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) { | 1102 TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) { |
| 1030 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 1103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 1031 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 1104 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 1032 &map_, transaction_id); | 1105 &map_, transaction_id); |
| 1033 if (!idb_transaction) | 1106 if (!idb_transaction) |
| 1034 return; | 1107 return; |
| 1035 | 1108 |
| 1036 idb_transaction->didCompleteTaskEvents(); | 1109 if (transaction_size_map_.find(transaction_id) == |
| 1110 transaction_size_map_.end()) { | |
|
michaeln
2011/07/27 01:31:35
i see... no Puts(), so no size map entry, so nothi
| |
| 1111 idb_transaction->didCompleteTaskEvents(); | |
| 1112 return; | |
| 1113 } | |
| 1114 // Check if there is available quota. | |
| 1115 IndexedDBGetUsageAndQuotaCallback* callback = | |
| 1116 new IndexedDBGetUsageAndQuotaCallback( | |
| 1117 transaction_size_map_[transaction_id], idb_transaction); | |
| 1118 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | |
| 1119 NewRunnableFunction(&RequestQuota, | |
| 1120 scoped_refptr<quota::QuotaManagerProxy>( | |
| 1121 parent_->Context()->quota_manager_proxy()), | |
| 1122 transaction_url_map_[transaction_id], | |
| 1123 callback)); | |
| 1124 | |
| 1037 } | 1125 } |
| 1038 | 1126 |
| 1039 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1127 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1040 int32 object_id) { | 1128 int32 object_id) { |
| 1041 parent_->DestroyObject(&map_, object_id); | 1129 parent_->DestroyObject(&map_, object_id); |
|
michaeln
2011/07/27 01:31:35
this might be a good place to erase from the trans
| |
| 1042 } | 1130 } |
| OLD | NEW |