OLD | NEW |
---|---|
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 Persistent<IDBTransaction> m_transaction; | 90 Persistent<IDBTransaction> m_transaction; |
91 }; | 91 }; |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 IDBTransaction::IDBTransaction(ScriptState* scriptState, | 95 IDBTransaction::IDBTransaction(ScriptState* scriptState, |
96 int64_t id, | 96 int64_t id, |
97 const HashSet<String>& scope, | 97 const HashSet<String>& scope, |
98 WebIDBTransactionMode mode, | 98 WebIDBTransactionMode mode, |
99 IDBDatabase* db) | 99 IDBDatabase* db) |
100 : ContextLifecycleObserver(scriptState->getExecutionContext()), | 100 : ContextClient(scriptState->getExecutionContext()), |
sof
2017/01/05 15:12:08
This one is flakily repro'ing on the bots,
https
| |
101 m_id(id), | 101 m_id(id), |
102 m_database(db), | 102 m_database(db), |
103 m_mode(mode), | 103 m_mode(mode), |
104 m_scope(scope) { | 104 m_scope(scope) { |
105 DCHECK(m_database); | 105 DCHECK(m_database); |
106 DCHECK(!m_scope.isEmpty()) << "Non-versionchange transactions must operate " | 106 DCHECK(!m_scope.isEmpty()) << "Non-versionchange transactions must operate " |
107 "on a well-defined set of stores"; | 107 "on a well-defined set of stores"; |
108 DCHECK(m_mode == WebIDBTransactionModeReadOnly || | 108 DCHECK(m_mode == WebIDBTransactionModeReadOnly || |
109 m_mode == WebIDBTransactionModeReadWrite) | 109 m_mode == WebIDBTransactionModeReadWrite) |
110 << "Invalid transaction mode"; | 110 << "Invalid transaction mode"; |
111 | 111 |
112 DCHECK_EQ(m_state, Active); | 112 DCHECK_EQ(m_state, Active); |
113 V8PerIsolateData::from(scriptState->isolate()) | 113 V8PerIsolateData::from(scriptState->isolate()) |
114 ->addEndOfScopeTask(DeactivateTransactionTask::create(this)); | 114 ->addEndOfScopeTask(DeactivateTransactionTask::create(this)); |
115 | 115 |
116 m_database->transactionCreated(this); | 116 m_database->transactionCreated(this); |
117 } | 117 } |
118 | 118 |
119 IDBTransaction::IDBTransaction(ExecutionContext* executionContext, | 119 IDBTransaction::IDBTransaction(ExecutionContext* executionContext, |
120 int64_t id, | 120 int64_t id, |
121 IDBDatabase* db, | 121 IDBDatabase* db, |
122 IDBOpenDBRequest* openDBRequest, | 122 IDBOpenDBRequest* openDBRequest, |
123 const IDBDatabaseMetadata& oldMetadata) | 123 const IDBDatabaseMetadata& oldMetadata) |
124 : ContextLifecycleObserver(executionContext), | 124 : ContextClient(executionContext), |
125 m_id(id), | 125 m_id(id), |
126 m_database(db), | 126 m_database(db), |
127 m_openDBRequest(openDBRequest), | 127 m_openDBRequest(openDBRequest), |
128 m_mode(WebIDBTransactionModeVersionChange), | 128 m_mode(WebIDBTransactionModeVersionChange), |
129 m_state(Inactive), | 129 m_state(Inactive), |
130 m_oldDatabaseMetadata(oldMetadata) { | 130 m_oldDatabaseMetadata(oldMetadata) { |
131 DCHECK(m_database); | 131 DCHECK(m_database); |
132 DCHECK(m_openDBRequest); | 132 DCHECK(m_openDBRequest); |
133 DCHECK(m_scope.isEmpty()); | 133 DCHECK(m_scope.isEmpty()); |
134 | 134 |
135 m_database->transactionCreated(this); | 135 m_database->transactionCreated(this); |
136 } | 136 } |
137 | 137 |
138 IDBTransaction::~IDBTransaction() { | 138 IDBTransaction::~IDBTransaction() { |
139 DCHECK(m_state == Finished || !getExecutionContext()); | 139 DCHECK(m_state == Finished || !getExecutionContext()); |
140 DCHECK(m_requestList.isEmpty() || !getExecutionContext()); | 140 DCHECK(m_requestList.isEmpty() || !getExecutionContext()); |
141 } | 141 } |
142 | 142 |
143 DEFINE_TRACE(IDBTransaction) { | 143 DEFINE_TRACE(IDBTransaction) { |
144 visitor->trace(m_database); | 144 visitor->trace(m_database); |
145 visitor->trace(m_openDBRequest); | 145 visitor->trace(m_openDBRequest); |
146 visitor->trace(m_error); | 146 visitor->trace(m_error); |
147 visitor->trace(m_requestList); | 147 visitor->trace(m_requestList); |
148 visitor->trace(m_objectStoreMap); | 148 visitor->trace(m_objectStoreMap); |
149 visitor->trace(m_oldStoreMetadata); | 149 visitor->trace(m_oldStoreMetadata); |
150 visitor->trace(m_deletedIndexes); | 150 visitor->trace(m_deletedIndexes); |
151 EventTargetWithInlineData::trace(visitor); | 151 EventTargetWithInlineData::trace(visitor); |
152 ContextLifecycleObserver::trace(visitor); | 152 ContextClient::trace(visitor); |
153 } | 153 } |
154 | 154 |
155 void IDBTransaction::setError(DOMException* error) { | 155 void IDBTransaction::setError(DOMException* error) { |
156 DCHECK_NE(m_state, Finished); | 156 DCHECK_NE(m_state, Finished); |
157 DCHECK(error); | 157 DCHECK(error); |
158 | 158 |
159 // The first error to be set is the true cause of the | 159 // The first error to be set is the true cause of the |
160 // transaction abort. | 160 // transaction abort. |
161 if (!m_error) | 161 if (!m_error) |
162 m_error = error; | 162 m_error = error; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 objectStoreNames->append(objectStoreName); | 445 objectStoreNames->append(objectStoreName); |
446 objectStoreNames->sort(); | 446 objectStoreNames->sort(); |
447 return objectStoreNames; | 447 return objectStoreNames; |
448 } | 448 } |
449 | 449 |
450 const AtomicString& IDBTransaction::interfaceName() const { | 450 const AtomicString& IDBTransaction::interfaceName() const { |
451 return EventTargetNames::IDBTransaction; | 451 return EventTargetNames::IDBTransaction; |
452 } | 452 } |
453 | 453 |
454 ExecutionContext* IDBTransaction::getExecutionContext() const { | 454 ExecutionContext* IDBTransaction::getExecutionContext() const { |
455 return ContextLifecycleObserver::getExecutionContext(); | 455 return ContextClient::getExecutionContext(); |
456 } | 456 } |
457 | 457 |
458 DispatchEventResult IDBTransaction::dispatchEventInternal(Event* event) { | 458 DispatchEventResult IDBTransaction::dispatchEventInternal(Event* event) { |
459 IDB_TRACE("IDBTransaction::dispatchEvent"); | 459 IDB_TRACE("IDBTransaction::dispatchEvent"); |
460 if (!getExecutionContext()) { | 460 if (!getExecutionContext()) { |
461 m_state = Finished; | 461 m_state = Finished; |
462 return DispatchEventResult::CanceledBeforeDispatch; | 462 return DispatchEventResult::CanceledBeforeDispatch; |
463 } | 463 } |
464 DCHECK_NE(m_state, Finished); | 464 DCHECK_NE(m_state, Finished); |
465 DCHECK(m_hasPendingActivity); | 465 DCHECK(m_hasPendingActivity); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 IDBObjectStore* objectStore = it.key; | 568 IDBObjectStore* objectStore = it.key; |
569 objectStore->clearIndexCache(); | 569 objectStore->clearIndexCache(); |
570 } | 570 } |
571 m_oldStoreMetadata.clear(); | 571 m_oldStoreMetadata.clear(); |
572 | 572 |
573 m_deletedIndexes.clear(); | 573 m_deletedIndexes.clear(); |
574 m_deletedObjectStores.clear(); | 574 m_deletedObjectStores.clear(); |
575 } | 575 } |
576 | 576 |
577 } // namespace blink | 577 } // namespace blink |
OLD | NEW |