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

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

Issue 2567913002: Rename ActiveDOMObject to SuspendableObject (Closed)
Patch Set: Created 4 years 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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 }; 96 };
97 97
98 } // namespace 98 } // namespace
99 99
100 IDBTransaction::IDBTransaction(ScriptState* scriptState, 100 IDBTransaction::IDBTransaction(ScriptState* scriptState,
101 int64_t id, 101 int64_t id,
102 const HashSet<String>& scope, 102 const HashSet<String>& scope,
103 WebIDBTransactionMode mode, 103 WebIDBTransactionMode mode,
104 IDBDatabase* db) 104 IDBDatabase* db)
105 : ActiveScriptWrappable(this), 105 : ActiveScriptWrappable(this),
106 ActiveDOMObject(scriptState->getExecutionContext()), 106 SuspendableObject(scriptState->getExecutionContext()),
107 m_id(id), 107 m_id(id),
108 m_database(db), 108 m_database(db),
109 m_mode(mode), 109 m_mode(mode),
110 m_scope(scope) { 110 m_scope(scope) {
111 DCHECK(m_database); 111 DCHECK(m_database);
112 DCHECK(!m_scope.isEmpty()) << "Non-versionchange transactions must operate " 112 DCHECK(!m_scope.isEmpty()) << "Non-versionchange transactions must operate "
113 "on a well-defined set of stores"; 113 "on a well-defined set of stores";
114 DCHECK(m_mode == WebIDBTransactionModeReadOnly || 114 DCHECK(m_mode == WebIDBTransactionModeReadOnly ||
115 m_mode == WebIDBTransactionModeReadWrite) 115 m_mode == WebIDBTransactionModeReadWrite)
116 << "Invalid transaction mode"; 116 << "Invalid transaction mode";
117 117
118 DCHECK_EQ(m_state, Active); 118 DCHECK_EQ(m_state, Active);
119 V8PerIsolateData::from(scriptState->isolate()) 119 V8PerIsolateData::from(scriptState->isolate())
120 ->addEndOfScopeTask(DeactivateTransactionTask::create(this)); 120 ->addEndOfScopeTask(DeactivateTransactionTask::create(this));
121 121
122 m_database->transactionCreated(this); 122 m_database->transactionCreated(this);
123 } 123 }
124 124
125 IDBTransaction::IDBTransaction(ExecutionContext* executionContext, 125 IDBTransaction::IDBTransaction(ExecutionContext* executionContext,
126 int64_t id, 126 int64_t id,
127 IDBDatabase* db, 127 IDBDatabase* db,
128 IDBOpenDBRequest* openDBRequest, 128 IDBOpenDBRequest* openDBRequest,
129 const IDBDatabaseMetadata& oldMetadata) 129 const IDBDatabaseMetadata& oldMetadata)
130 : ActiveScriptWrappable(this), 130 : ActiveScriptWrappable(this),
131 ActiveDOMObject(executionContext), 131 SuspendableObject(executionContext),
132 m_id(id), 132 m_id(id),
133 m_database(db), 133 m_database(db),
134 m_openDBRequest(openDBRequest), 134 m_openDBRequest(openDBRequest),
135 m_mode(WebIDBTransactionModeVersionChange), 135 m_mode(WebIDBTransactionModeVersionChange),
136 m_state(Inactive), 136 m_state(Inactive),
137 m_oldDatabaseMetadata(oldMetadata) { 137 m_oldDatabaseMetadata(oldMetadata) {
138 DCHECK(m_database); 138 DCHECK(m_database);
139 DCHECK(m_openDBRequest); 139 DCHECK(m_openDBRequest);
140 DCHECK(m_scope.isEmpty()); 140 DCHECK(m_scope.isEmpty());
141 141
142 m_database->transactionCreated(this); 142 m_database->transactionCreated(this);
143 } 143 }
144 144
145 IDBTransaction::~IDBTransaction() { 145 IDBTransaction::~IDBTransaction() {
146 DCHECK(m_state == Finished || !getExecutionContext()); 146 DCHECK(m_state == Finished || !getExecutionContext());
147 DCHECK(m_requestList.isEmpty() || !getExecutionContext()); 147 DCHECK(m_requestList.isEmpty() || !getExecutionContext());
148 } 148 }
149 149
150 DEFINE_TRACE(IDBTransaction) { 150 DEFINE_TRACE(IDBTransaction) {
151 visitor->trace(m_database); 151 visitor->trace(m_database);
152 visitor->trace(m_openDBRequest); 152 visitor->trace(m_openDBRequest);
153 visitor->trace(m_error); 153 visitor->trace(m_error);
154 visitor->trace(m_requestList); 154 visitor->trace(m_requestList);
155 visitor->trace(m_objectStoreMap); 155 visitor->trace(m_objectStoreMap);
156 visitor->trace(m_oldStoreMetadata); 156 visitor->trace(m_oldStoreMetadata);
157 visitor->trace(m_deletedIndexes); 157 visitor->trace(m_deletedIndexes);
158 EventTargetWithInlineData::trace(visitor); 158 EventTargetWithInlineData::trace(visitor);
159 ActiveDOMObject::trace(visitor); 159 SuspendableObject::trace(visitor);
160 } 160 }
161 161
162 void IDBTransaction::setError(DOMException* error) { 162 void IDBTransaction::setError(DOMException* error) {
163 DCHECK_NE(m_state, Finished); 163 DCHECK_NE(m_state, Finished);
164 DCHECK(error); 164 DCHECK(error);
165 165
166 // The first error to be set is the true cause of the 166 // The first error to be set is the true cause of the
167 // transaction abort. 167 // transaction abort.
168 if (!m_error) 168 if (!m_error)
169 m_error = error; 169 m_error = error;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 objectStoreNames->append(objectStoreName); 452 objectStoreNames->append(objectStoreName);
453 objectStoreNames->sort(); 453 objectStoreNames->sort();
454 return objectStoreNames; 454 return objectStoreNames;
455 } 455 }
456 456
457 const AtomicString& IDBTransaction::interfaceName() const { 457 const AtomicString& IDBTransaction::interfaceName() const {
458 return EventTargetNames::IDBTransaction; 458 return EventTargetNames::IDBTransaction;
459 } 459 }
460 460
461 ExecutionContext* IDBTransaction::getExecutionContext() const { 461 ExecutionContext* IDBTransaction::getExecutionContext() const {
462 return ActiveDOMObject::getExecutionContext(); 462 return SuspendableObject::getExecutionContext();
463 } 463 }
464 464
465 DispatchEventResult IDBTransaction::dispatchEventInternal(Event* event) { 465 DispatchEventResult IDBTransaction::dispatchEventInternal(Event* event) {
466 IDB_TRACE("IDBTransaction::dispatchEvent"); 466 IDB_TRACE("IDBTransaction::dispatchEvent");
467 if (!getExecutionContext()) { 467 if (!getExecutionContext()) {
468 m_state = Finished; 468 m_state = Finished;
469 return DispatchEventResult::CanceledBeforeDispatch; 469 return DispatchEventResult::CanceledBeforeDispatch;
470 } 470 }
471 DCHECK_NE(m_state, Finished); 471 DCHECK_NE(m_state, Finished);
472 DCHECK(m_hasPendingActivity); 472 DCHECK(m_hasPendingActivity);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 IDBObjectStore* objectStore = it.key; 575 IDBObjectStore* objectStore = it.key;
576 objectStore->clearIndexCache(); 576 objectStore->clearIndexCache();
577 } 577 }
578 m_oldStoreMetadata.clear(); 578 m_oldStoreMetadata.clear();
579 579
580 m_deletedIndexes.clear(); 580 m_deletedIndexes.clear();
581 m_deletedObjectStores.clear(); 581 m_deletedObjectStores.clear();
582 } 582 }
583 583
584 } // namespace blink 584 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698