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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp

Issue 2808763007: IndexedDB: Clean up boilerplate when throwing TransactionInactiveError (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 const AtomicString& IDBTransaction::InterfaceName() const { 480 const AtomicString& IDBTransaction::InterfaceName() const {
481 return EventTargetNames::IDBTransaction; 481 return EventTargetNames::IDBTransaction;
482 } 482 }
483 483
484 ExecutionContext* IDBTransaction::GetExecutionContext() const { 484 ExecutionContext* IDBTransaction::GetExecutionContext() const {
485 return ContextLifecycleObserver::GetExecutionContext(); 485 return ContextLifecycleObserver::GetExecutionContext();
486 } 486 }
487 487
488 const char* IDBTransaction::InactiveErrorMessage() const {
489 switch (state_) {
490 case kActive:
491 // Callers should check !IsActive() before calling.
492 NOTREACHED();
493 return nullptr;
494 case kInactive:
495 return IDBDatabase::kTransactionInactiveErrorMessage;
496 case kFinishing:
497 case kFinished:
498 return IDBDatabase::kTransactionFinishedErrorMessage;
499 }
500 NOTREACHED();
501 return nullptr;
502 }
503
488 DispatchEventResult IDBTransaction::DispatchEventInternal(Event* event) { 504 DispatchEventResult IDBTransaction::DispatchEventInternal(Event* event) {
489 IDB_TRACE("IDBTransaction::dispatchEvent"); 505 IDB_TRACE("IDBTransaction::dispatchEvent");
490 if (!GetExecutionContext()) { 506 if (!GetExecutionContext()) {
491 state_ = kFinished; 507 state_ = kFinished;
492 return DispatchEventResult::kCanceledBeforeDispatch; 508 return DispatchEventResult::kCanceledBeforeDispatch;
493 } 509 }
494 DCHECK_NE(state_, kFinished); 510 DCHECK_NE(state_, kFinished);
495 DCHECK(has_pending_activity_); 511 DCHECK(has_pending_activity_);
496 DCHECK(GetExecutionContext()); 512 DCHECK(GetExecutionContext());
497 DCHECK_EQ(event->target(), this); 513 DCHECK_EQ(event->target(), this);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 IDBObjectStore* object_store = it.key; 614 IDBObjectStore* object_store = it.key;
599 object_store->ClearIndexCache(); 615 object_store->ClearIndexCache();
600 } 616 }
601 old_store_metadata_.Clear(); 617 old_store_metadata_.Clear();
602 618
603 deleted_indexes_.Clear(); 619 deleted_indexes_.Clear();
604 deleted_object_stores_.Clear(); 620 deleted_object_stores_.Clear();
605 } 621 }
606 622
607 } // namespace blink 623 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698