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 66 matching lines...) Loading... |
77 private: | 77 private: |
78 explicit DeactivateTransactionTask(IDBTransaction* transaction) | 78 explicit DeactivateTransactionTask(IDBTransaction* transaction) |
79 : m_transaction(transaction) { } | 79 : m_transaction(transaction) { } |
80 | 80 |
81 Persistent<IDBTransaction> m_transaction; | 81 Persistent<IDBTransaction> m_transaction; |
82 }; | 82 }; |
83 | 83 |
84 } // namespace | 84 } // namespace |
85 | 85 |
86 IDBTransaction::IDBTransaction(ScriptState* scriptState, int64_t id, const HashS
et<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db, IDBOp
enDBRequest* openDBRequest, const IDBDatabaseMetadata& previousMetadata) | 86 IDBTransaction::IDBTransaction(ScriptState* scriptState, int64_t id, const HashS
et<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db, IDBOp
enDBRequest* openDBRequest, const IDBDatabaseMetadata& previousMetadata) |
87 : ActiveDOMObject(scriptState->executionContext()) | 87 : ActiveDOMObject(scriptState->getExecutionContext()) |
88 , m_id(id) | 88 , m_id(id) |
89 , m_database(db) | 89 , m_database(db) |
90 , m_objectStoreNames(objectStoreNames) | 90 , m_objectStoreNames(objectStoreNames) |
91 , m_openDBRequest(openDBRequest) | 91 , m_openDBRequest(openDBRequest) |
92 , m_mode(mode) | 92 , m_mode(mode) |
93 , m_previousMetadata(previousMetadata) | 93 , m_previousMetadata(previousMetadata) |
94 { | 94 { |
95 if (mode == WebIDBTransactionModeVersionChange) { | 95 if (mode == WebIDBTransactionModeVersionChange) { |
96 // Not active until the callback. | 96 // Not active until the callback. |
97 m_state = Inactive; | 97 m_state = Inactive; |
(...skipping 234 matching lines...) Loading... |
332 objectStoreNames->append(name); | 332 objectStoreNames->append(name); |
333 objectStoreNames->sort(); | 333 objectStoreNames->sort(); |
334 return objectStoreNames.release(); | 334 return objectStoreNames.release(); |
335 } | 335 } |
336 | 336 |
337 const AtomicString& IDBTransaction::interfaceName() const | 337 const AtomicString& IDBTransaction::interfaceName() const |
338 { | 338 { |
339 return EventTargetNames::IDBTransaction; | 339 return EventTargetNames::IDBTransaction; |
340 } | 340 } |
341 | 341 |
342 ExecutionContext* IDBTransaction::executionContext() const | 342 ExecutionContext* IDBTransaction::getExecutionContext() const |
343 { | 343 { |
344 return ActiveDOMObject::executionContext(); | 344 return ActiveDOMObject::getExecutionContext(); |
345 } | 345 } |
346 | 346 |
347 DispatchEventResult IDBTransaction::dispatchEventInternal(PassRefPtrWillBeRawPtr
<Event> event) | 347 DispatchEventResult IDBTransaction::dispatchEventInternal(PassRefPtrWillBeRawPtr
<Event> event) |
348 { | 348 { |
349 IDB_TRACE("IDBTransaction::dispatchEvent"); | 349 IDB_TRACE("IDBTransaction::dispatchEvent"); |
350 if (m_contextStopped || !executionContext()) { | 350 if (m_contextStopped || !getExecutionContext()) { |
351 m_state = Finished; | 351 m_state = Finished; |
352 return DispatchEventResult::CanceledBeforeDispatch; | 352 return DispatchEventResult::CanceledBeforeDispatch; |
353 } | 353 } |
354 ASSERT(m_state != Finished); | 354 ASSERT(m_state != Finished); |
355 ASSERT(m_hasPendingActivity); | 355 ASSERT(m_hasPendingActivity); |
356 ASSERT(executionContext()); | 356 ASSERT(getExecutionContext()); |
357 ASSERT(event->target() == this); | 357 ASSERT(event->target() == this); |
358 m_state = Finished; | 358 m_state = Finished; |
359 | 359 |
360 // Break reference cycles. | 360 // Break reference cycles. |
361 for (auto& it : m_objectStoreMap) | 361 for (auto& it : m_objectStoreMap) |
362 it.value->transactionFinished(); | 362 it.value->transactionFinished(); |
363 m_objectStoreMap.clear(); | 363 m_objectStoreMap.clear(); |
364 for (auto& it : m_deletedObjectStores) | 364 for (auto& it : m_deletedObjectStores) |
365 it->transactionFinished(); | 365 it->transactionFinished(); |
366 m_deletedObjectStores.clear(); | 366 m_deletedObjectStores.clear(); |
(...skipping 21 matching lines...) Loading... |
388 return; | 388 return; |
389 | 389 |
390 m_contextStopped = true; | 390 m_contextStopped = true; |
391 | 391 |
392 abort(IGNORE_EXCEPTION); | 392 abort(IGNORE_EXCEPTION); |
393 } | 393 } |
394 | 394 |
395 void IDBTransaction::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) | 395 void IDBTransaction::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) |
396 { | 396 { |
397 ASSERT_WITH_MESSAGE(m_state != Finished, "A finished transaction tried to en
queue an event of type %s.", event->type().utf8().data()); | 397 ASSERT_WITH_MESSAGE(m_state != Finished, "A finished transaction tried to en
queue an event of type %s.", event->type().utf8().data()); |
398 if (m_contextStopped || !executionContext()) | 398 if (m_contextStopped || !getExecutionContext()) |
399 return; | 399 return; |
400 | 400 |
401 EventQueue* eventQueue = executionContext()->eventQueue(); | 401 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
402 event->setTarget(this); | 402 event->setTarget(this); |
403 eventQueue->enqueueEvent(event); | 403 eventQueue->enqueueEvent(event); |
404 } | 404 } |
405 | 405 |
406 WebIDBDatabase* IDBTransaction::backendDB() const | 406 WebIDBDatabase* IDBTransaction::backendDB() const |
407 { | 407 { |
408 return m_database->backend(); | 408 return m_database->backend(); |
409 } | 409 } |
410 | 410 |
411 } // namespace blink | 411 } // namespace blink |
OLD | NEW |