Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Side by Side Diff: content/browser/in_process_webkit/indexed_db_dispatcher_host.cc

Issue 7470008: Improve IndexedDB's quota support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed easy comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h " 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h "
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
30 #include "webkit/glue/webkit_glue.h" 30 #include "webkit/glue/webkit_glue.h"
31 #include "webkit/quota/quota_manager.h"
32 31
33 using WebKit::WebDOMStringList; 32 using WebKit::WebDOMStringList;
34 using WebKit::WebExceptionCode; 33 using WebKit::WebExceptionCode;
35 using WebKit::WebIDBCallbacks; 34 using WebKit::WebIDBCallbacks;
36 using WebKit::WebIDBCursor; 35 using WebKit::WebIDBCursor;
37 using WebKit::WebIDBDatabase; 36 using WebKit::WebIDBDatabase;
38 using WebKit::WebIDBDatabaseError; 37 using WebKit::WebIDBDatabaseError;
39 using WebKit::WebIDBIndex; 38 using WebKit::WebIDBIndex;
40 using WebKit::WebIDBKey; 39 using WebKit::WebIDBKey;
41 using WebKit::WebIDBKeyRange; 40 using WebKit::WebIDBKeyRange;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return cursor_dispatcher_host_->map_.Add(idb_cursor); 147 return cursor_dispatcher_host_->map_.Add(idb_cursor);
149 } 148 }
150 149
151 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database, 150 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database,
152 const GURL& origin_url) { 151 const GURL& origin_url) {
153 if (!database_dispatcher_host_.get()) { 152 if (!database_dispatcher_host_.get()) {
154 delete idb_database; 153 delete idb_database;
155 return 0; 154 return 0;
156 } 155 }
157 int32 idb_database_id = database_dispatcher_host_->map_.Add(idb_database); 156 int32 idb_database_id = database_dispatcher_host_->map_.Add(idb_database);
158 database_dispatcher_host_->url_map_[idb_database_id] = origin_url; 157 Context()->NewConnection(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
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.
(...skipping 15 matching lines...) Expand all
219 } 222 }
220 223
221 WebKit::WebIDBFactory::BackingStoreType backingStoreType = 224 WebKit::WebIDBFactory::BackingStoreType backingStoreType =
222 WebKit::WebIDBFactory::LevelDBBackingStore; 225 WebKit::WebIDBFactory::LevelDBBackingStore;
223 226
224 if (CommandLine::ForCurrentProcess()->HasSwitch( 227 if (CommandLine::ForCurrentProcess()->HasSwitch(
225 switches::kSQLiteIndexedDatabase)) { 228 switches::kSQLiteIndexedDatabase)) {
226 backingStoreType = WebKit::WebIDBFactory::SQLiteBackingStore; 229 backingStoreType = WebKit::WebIDBFactory::SQLiteBackingStore;
227 } 230 }
228 231
232 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore
233 // created) if this origin is already over quota.
229 Context()->GetIDBFactory()->open( 234 Context()->GetIDBFactory()->open(
230 params.name, 235 params.name,
231 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id, 236 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id,
232 origin_url), 237 origin_url),
233 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path), quota, 238 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path), quota,
234 backingStoreType); 239 backingStoreType);
235 } 240 }
236 241
237 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( 242 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase(
238 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { 243 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) {
239 FilePath base_path = webkit_context_->data_path(); 244 FilePath base_path = webkit_context_->data_path();
240 FilePath indexed_db_path; 245 FilePath indexed_db_path;
241 if (!base_path.empty()) { 246 if (!base_path.empty()) {
242 indexed_db_path = base_path.Append( 247 indexed_db_path = base_path.Append(
243 IndexedDBContext::kIndexedDBDirectory); 248 IndexedDBContext::kIndexedDBDirectory);
244 } 249 }
245 250
246 WebSecurityOrigin origin( 251 WebSecurityOrigin origin(
247 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); 252 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
248 GURL url(origin.toString()); 253 GURL url(origin.toString());
249 254
250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
251 Context()->GetIDBFactory()->deleteDatabase( 256 Context()->GetIDBFactory()->deleteDatabase(
252 params.name, 257 params.name,
253 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id, url), 258 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id, url),
254 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, 259 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL,
255 webkit_glue::FilePathToWebString(indexed_db_path)); 260 webkit_glue::FilePathToWebString(indexed_db_path));
256 } 261 }
257 262
263 void IndexedDBDispatcherHost::CleanupTransactionMaps(int32 transaction_id) {
264 transaction_dispatcher_host_->transaction_size_map_.erase(transaction_id);
265 transaction_dispatcher_host_->transaction_url_map_.erase(transaction_id);
266 }
267
268 void IndexedDBDispatcherHost::TransactionComplete(int32 transaction_id) {
269 Context()->TransactionComplete(
270 transaction_dispatcher_host_->transaction_url_map_[transaction_id]);
271 CleanupTransactionMaps(transaction_id);
272 }
273
274 void IndexedDBDispatcherHost::TransactionAborted(int32 transaction_id) {
275 CleanupTransactionMaps(transaction_id);
276 }
277
258 ////////////////////////////////////////////////////////////////////// 278 //////////////////////////////////////////////////////////////////////
259 // Helper templates. 279 // Helper templates.
260 // 280 //
261 281
262 template <typename ObjectType> 282 template <typename ObjectType>
263 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( 283 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess(
264 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { 284 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) {
265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
266 ObjectType* return_object = map->Lookup(return_object_id); 286 ObjectType* return_object = map->Lookup(return_object_id);
267 if (!return_object) { 287 if (!return_object) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 384 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
365 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 385 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
366 if (!idb_database || !idb_transaction) 386 if (!idb_database || !idb_transaction)
367 return; 387 return;
368 388
369 *ec = 0; 389 *ec = 0;
370 WebIDBObjectStore* object_store = idb_database->createObjectStore( 390 WebIDBObjectStore* object_store = idb_database->createObjectStore(
371 params.name, params.key_path, params.auto_increment, 391 params.name, params.key_path, params.auto_increment,
372 *idb_transaction, *ec); 392 *idb_transaction, *ec);
373 *object_store_id = *ec ? 0 : parent_->Add(object_store); 393 *object_store_id = *ec ? 0 : parent_->Add(object_store);
394 if (parent_->Context()->IsOverQuota(
395 database_url_map_[params.idb_database_id])) {
396 idb_transaction->abort();
397 }
374 } 398 }
375 399
376 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore( 400 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore(
377 int32 idb_database_id, 401 int32 idb_database_id,
378 const string16& name, 402 const string16& name,
379 int32 transaction_id, 403 int32 transaction_id,
380 WebKit::WebExceptionCode* ec) { 404 WebKit::WebExceptionCode* ec) {
381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
382 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 406 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
383 &map_, idb_database_id); 407 &map_, idb_database_id);
(...skipping 13 matching lines...) Expand all
397 WebKit::WebExceptionCode* ec) { 421 WebKit::WebExceptionCode* ec) {
398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 422 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
399 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 423 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
400 &map_, idb_database_id); 424 &map_, idb_database_id);
401 if (!idb_database) 425 if (!idb_database)
402 return; 426 return;
403 427
404 *ec = 0; 428 *ec = 0;
405 idb_database->setVersion( 429 idb_database->setVersion(
406 version, 430 version,
407 new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id), 431 new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id,
432 database_url_map_[idb_database_id]),
408 *ec); 433 *ec);
409 } 434 }
410 435
411 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( 436 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
412 int32 idb_database_id, 437 int32 idb_database_id,
413 const std::vector<string16>& names, 438 const std::vector<string16>& names,
414 int32 mode, 439 int32 mode,
415 int32 timeout, 440 int32 timeout,
416 int32* idb_transaction_id, 441 int32* idb_transaction_id,
417 WebKit::WebExceptionCode* ec) { 442 WebKit::WebExceptionCode* ec) {
418 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 443 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
419 &map_, idb_database_id); 444 &map_, idb_database_id);
420 if (!database) 445 if (!database)
421 return; 446 return;
422 447
423 WebDOMStringList object_stores; 448 WebDOMStringList object_stores;
424 for (std::vector<string16>::const_iterator it = names.begin(); 449 for (std::vector<string16>::const_iterator it = names.begin();
425 it != names.end(); ++it) { 450 it != names.end(); ++it) {
426 object_stores.append(*it); 451 object_stores.append(*it);
427 } 452 }
428 453
429 *ec = 0; 454 *ec = 0;
430 WebIDBTransaction* transaction = database->transaction( 455 WebIDBTransaction* transaction = database->transaction(
431 object_stores, mode, timeout, *ec); 456 object_stores, mode, timeout, *ec);
432 DCHECK(!transaction != !*ec); 457 DCHECK(!transaction != !*ec);
433 *idb_transaction_id = *ec ? 0 : parent_->Add(transaction); 458 *idb_transaction_id =
459 *ec ? 0 : parent_->Add(transaction, database_url_map_[idb_database_id]);
434 } 460 }
435 461
436 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( 462 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen(
437 int32 idb_database_id, int32 response_id) { 463 int32 idb_database_id, int32 response_id) {
438 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 464 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
439 &map_, idb_database_id); 465 &map_, idb_database_id);
440 database->open(new IndexedDBDatabaseCallbacks(parent_, response_id)); 466 database->open(new IndexedDBDatabaseCallbacks(parent_, response_id));
441 } 467 }
442 468
443 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( 469 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose(
444 int32 idb_database_id) { 470 int32 idb_database_id) {
445 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 471 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
446 &map_, idb_database_id); 472 &map_, idb_database_id);
447 database->close(); 473 database->close();
448 parent_->Context()->quota_manager_proxy()->NotifyStorageAccessed( 474 const GURL origin_url = database_url_map_[idb_database_id];
449 quota::QuotaClient::kIndexedDatabase, url_map_[idb_database_id], 475 database_url_map_.erase(idb_database_id);
450 quota::kStorageTypeTemporary); 476 parent_->Context()->ConnectionClosed(origin_url);
451 url_map_.erase(idb_database_id);
452 } 477 }
453 478
454 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( 479 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed(
455 int32 object_id) { 480 int32 object_id) {
456 parent_->DestroyObject(&map_, object_id); 481 parent_->DestroyObject(&map_, object_id);
457 } 482 }
458 483
459 484
460 ////////////////////////////////////////////////////////////////////// 485 //////////////////////////////////////////////////////////////////////
461 // IndexedDBDispatcherHost::IndexDispatcherHost 486 // IndexedDBDispatcherHost::IndexDispatcherHost
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 722 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
698 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 723 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
699 if (!idb_transaction || !idb_object_store) 724 if (!idb_transaction || !idb_object_store)
700 return; 725 return;
701 726
702 *ec = 0; 727 *ec = 0;
703 scoped_ptr<WebIDBCallbacks> callbacks( 728 scoped_ptr<WebIDBCallbacks> callbacks(
704 new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id)); 729 new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id));
705 idb_object_store->put(params.serialized_value, params.key, params.put_mode, 730 idb_object_store->put(params.serialized_value, params.key, params.put_mode,
706 callbacks.release(), *idb_transaction, *ec); 731 callbacks.release(), *idb_transaction, *ec);
732 if (*ec)
733 return;
734 int64 size = UTF16ToUTF8(params.serialized_value.data()).size();
735 WebIDBTransactionIDToSizeMap* map =
736 &parent_->transaction_dispatcher_host_->transaction_size_map_;
737 (*map)[params.transaction_id] += size;
707 } 738 }
708 739
709 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete( 740 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete(
710 int idb_object_store_id, 741 int idb_object_store_id,
711 int32 response_id, 742 int32 response_id,
712 const IndexedDBKey& key, 743 const IndexedDBKey& key,
713 int32 transaction_id, 744 int32 transaction_id,
714 WebKit::WebExceptionCode* ec) { 745 WebKit::WebExceptionCode* ec) {
715 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 746 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
716 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 747 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 &map_, params.idb_object_store_id); 785 &map_, params.idb_object_store_id);
755 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 786 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
756 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 787 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
757 if (!idb_object_store || !idb_transaction) 788 if (!idb_object_store || !idb_transaction)
758 return; 789 return;
759 790
760 *ec = 0; 791 *ec = 0;
761 WebIDBIndex* index = idb_object_store->createIndex( 792 WebIDBIndex* index = idb_object_store->createIndex(
762 params.name, params.key_path, params.unique, *idb_transaction, *ec); 793 params.name, params.key_path, params.unique, *idb_transaction, *ec);
763 *index_id = *ec ? 0 : parent_->Add(index); 794 *index_id = *ec ? 0 : parent_->Add(index);
795 WebIDBObjectIDToURLMap* transaction_url_map =
796 &parent_->transaction_dispatcher_host_->transaction_url_map_;
797 if (parent_->Context()->IsOverQuota(
798 (*transaction_url_map)[params.transaction_id])) {
799 idb_transaction->abort();
800 }
764 } 801 }
765 802
766 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex( 803 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex(
767 int32 idb_object_store_id, 804 int32 idb_object_store_id,
768 const string16& name, 805 const string16& name,
769 int32* idb_index_id, 806 int32* idb_index_id,
770 WebKit::WebExceptionCode* ec) { 807 WebKit::WebExceptionCode* ec) {
771 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 808 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
772 &map_, idb_object_store_id); 809 &map_, idb_object_store_id);
773 if (!idb_object_store) 810 if (!idb_object_store)
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 } 1063 }
1027 1064
1028 void IndexedDBDispatcherHost:: 1065 void IndexedDBDispatcherHost::
1029 TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) { 1066 TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) {
1030 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1067 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
1031 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 1068 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
1032 &map_, transaction_id); 1069 &map_, transaction_id);
1033 if (!idb_transaction) 1070 if (!idb_transaction)
1034 return; 1071 return;
1035 1072
1073 if (parent_->Context()->WouldBeOverQuota(
1074 transaction_url_map_[transaction_id],
1075 transaction_size_map_[transaction_id])) {
1076 idb_transaction->abort();
1077 return;
1078 }
1036 idb_transaction->didCompleteTaskEvents(); 1079 idb_transaction->didCompleteTaskEvents();
1037 } 1080 }
1038 1081
1039 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1082 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1040 int32 object_id) { 1083 int32 object_id) {
1041 parent_->DestroyObject(&map_, object_id); 1084 parent_->DestroyObject(&map_, object_id);
1042 } 1085 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698