Chromium Code Reviews| 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 | |
| 34 const char* IDBPendingTransactionMonitor::supplementName() | 36 const char* IDBPendingTransactionMonitor::supplementName() |
| 35 { | 37 { |
| 36 return "IDBPendingTransactionMonitor"; | 38 return "IDBPendingTransactionMonitor"; |
| 37 } | 39 } |
| 38 | 40 |
| 39 inline IDBPendingTransactionMonitor::IDBPendingTransactionMonitor() | 41 inline IDBPendingTransactionMonitor::IDBPendingTransactionMonitor() |
| 40 { | 42 { |
| 41 } | 43 } |
| 42 | 44 |
| 43 IDBPendingTransactionMonitor& IDBPendingTransactionMonitor::from(Supplementable< ExecutionContext>& context) | 45 IDBPendingTransactionMonitor& IDBPendingTransactionMonitor::from(WillBeHeapSuppl ementable<ExecutionContext>& context) |
| 44 { | 46 { |
| 45 IDBPendingTransactionMonitor* supplement = static_cast<IDBPendingTransaction Monitor*>(Supplement<ExecutionContext>::from(context, supplementName())); | 47 IDBPendingTransactionMonitor* supplement = static_cast<IDBPendingTransaction Monitor*>(WillBeHeapSupplement<ExecutionContext>::from(context, supplementName() )); |
| 46 if (!supplement) { | 48 if (!supplement) { |
| 47 supplement = new IDBPendingTransactionMonitor(); | 49 supplement = new IDBPendingTransactionMonitor(); |
| 48 provideTo(context, supplementName(), adoptPtr(supplement)); | 50 provideTo(context, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 49 } | 51 } |
| 50 return *supplement; | 52 return *supplement; |
| 51 } | 53 } |
| 52 | 54 |
| 53 IDBPendingTransactionMonitor::~IDBPendingTransactionMonitor() | |
| 54 { | |
| 55 } | |
| 56 | |
| 57 void IDBPendingTransactionMonitor::addNewTransaction(IDBTransaction& transaction ) | 55 void IDBPendingTransactionMonitor::addNewTransaction(IDBTransaction& transaction ) |
| 58 { | 56 { |
| 59 m_transactions.append(&transaction); | 57 m_transactions.append(&transaction); |
| 60 } | 58 } |
| 61 | 59 |
| 62 void IDBPendingTransactionMonitor::deactivateNewTransactions() | 60 void IDBPendingTransactionMonitor::deactivateNewTransactions() |
| 63 { | 61 { |
| 64 for (size_t i = 0; i < m_transactions.size(); ++i) | 62 for (size_t i = 0; i < m_transactions.size(); ++i) |
| 65 m_transactions[i]->setActive(false); | 63 m_transactions[i]->setActive(false); |
| 66 // FIXME: Exercise this call to clear() in a layout test. | 64 // FIXME: Exercise this call to clear() in a layout test. |
| 67 m_transactions.clear(); | 65 m_transactions.clear(); |
| 68 } | 66 } |
| 69 | 67 |
| 68 void IDBPendingTransactionMonitor::trace(Visitor* visitor) | |
| 69 { | |
| 70 #if ENABLE(OILPAN) | |
| 71 visitor->trace(m_transactions); | |
| 72 #endif | |
| 73 WillBeHeapSupplement<ExecutionContext>::trace(visitor); } | |
|
haraken
2014/07/21 14:47:04
'}' should be written in the next line.
wibling-chromium
2014/07/22 08:24:34
Done.
| |
| 70 }; | 74 }; |
| OLD | NEW |