| 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 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" | 27 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" |
| 28 | 28 |
| 29 #include "core/dom/ExecutionContext.h" | 29 #include "core/dom/ExecutionContext.h" |
| 30 #include "modules/indexeddb/IDBTransaction.h" | 30 #include "modules/indexeddb/IDBTransaction.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(IDBPendingTransactionMonitor) | |
| 35 | |
| 36 const char* IDBPendingTransactionMonitor::supplementName() | 34 const char* IDBPendingTransactionMonitor::supplementName() |
| 37 { | 35 { |
| 38 return "IDBPendingTransactionMonitor"; | 36 return "IDBPendingTransactionMonitor"; |
| 39 } | 37 } |
| 40 | 38 |
| 41 inline IDBPendingTransactionMonitor::IDBPendingTransactionMonitor() | 39 inline IDBPendingTransactionMonitor::IDBPendingTransactionMonitor() |
| 42 { | 40 { |
| 43 } | 41 } |
| 44 | 42 |
| 45 IDBPendingTransactionMonitor& IDBPendingTransactionMonitor::from(WillBeHeapSuppl
ementable<ExecutionContext>& context) | 43 IDBPendingTransactionMonitor& IDBPendingTransactionMonitor::from(Supplementable<
ExecutionContext>& context) |
| 46 { | 44 { |
| 47 IDBPendingTransactionMonitor* supplement = static_cast<IDBPendingTransaction
Monitor*>(WillBeHeapSupplement<ExecutionContext>::from(context, supplementName()
)); | 45 IDBPendingTransactionMonitor* supplement = static_cast<IDBPendingTransaction
Monitor*>(Supplement<ExecutionContext>::from(context, supplementName())); |
| 48 if (!supplement) { | 46 if (!supplement) { |
| 49 supplement = new IDBPendingTransactionMonitor(); | 47 supplement = new IDBPendingTransactionMonitor(); |
| 50 provideTo(context, supplementName(), adoptPtrWillBeNoop(supplement)); | 48 provideTo(context, supplementName(), adoptPtr(supplement)); |
| 51 } | 49 } |
| 52 return *supplement; | 50 return *supplement; |
| 53 } | 51 } |
| 54 | 52 |
| 53 IDBPendingTransactionMonitor::~IDBPendingTransactionMonitor() |
| 54 { |
| 55 } |
| 56 |
| 55 void IDBPendingTransactionMonitor::addNewTransaction(IDBTransaction& transaction
) | 57 void IDBPendingTransactionMonitor::addNewTransaction(IDBTransaction& transaction
) |
| 56 { | 58 { |
| 57 m_transactions.append(&transaction); | 59 m_transactions.append(&transaction); |
| 58 } | 60 } |
| 59 | 61 |
| 60 void IDBPendingTransactionMonitor::deactivateNewTransactions() | 62 void IDBPendingTransactionMonitor::deactivateNewTransactions() |
| 61 { | 63 { |
| 62 for (size_t i = 0; i < m_transactions.size(); ++i) | 64 for (size_t i = 0; i < m_transactions.size(); ++i) |
| 63 m_transactions[i]->setActive(false); | 65 m_transactions[i]->setActive(false); |
| 64 // FIXME: Exercise this call to clear() in a layout test. | 66 // FIXME: Exercise this call to clear() in a layout test. |
| 65 m_transactions.clear(); | 67 m_transactions.clear(); |
| 66 } | 68 } |
| 67 | 69 |
| 68 void IDBPendingTransactionMonitor::trace(Visitor* visitor) | 70 }; |
| 69 { | |
| 70 #if ENABLE(OILPAN) | |
| 71 visitor->trace(m_transactions); | |
| 72 #endif | |
| 73 WillBeHeapSupplement<ExecutionContext>::trace(visitor); | |
| 74 } | |
| 75 | |
| 76 } // namespace blink | |
| OLD | NEW |