| 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 #ifndef IDBPendingTransactionMonitor_h | 26 #ifndef IDBPendingTransactionMonitor_h |
| 27 #define IDBPendingTransactionMonitor_h | 27 #define IDBPendingTransactionMonitor_h |
| 28 | 28 |
| 29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
| 30 #include "wtf/Noncopyable.h" | 30 #include "wtf/Noncopyable.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class IDBCursor; | |
| 35 class IDBDisposerDispatcher; | |
| 36 class IDBRequest; | |
| 37 class IDBTransaction; | 34 class IDBTransaction; |
| 38 | 35 |
| 39 // This class keeps track of the transactions created during the current | 36 // This class keeps track of the transactions created during the current |
| 40 // Javascript execution context. Transactions have an internal |active| flag | 37 // Javascript execution context. Transactions have an internal |active| flag |
| 41 // which is set to true on creation, but must be set to false when control | 38 // which is set to true on creation, but must be set to false when control |
| 42 // returns to the event loop. | 39 // returns to the event loop. |
| 43 // Also, this class is responsible to call IDBRequest::dispose() before an | |
| 44 // IDBRequest object dies, and responsible to call IDBCursor::dispose() before | |
| 45 // an IDBCursor object dies. | |
| 46 // FIXME: Rename the class name. | |
| 47 class IDBPendingTransactionMonitor { | 40 class IDBPendingTransactionMonitor { |
| 48 WTF_MAKE_NONCOPYABLE(IDBPendingTransactionMonitor); | 41 WTF_MAKE_NONCOPYABLE(IDBPendingTransactionMonitor); |
| 49 | 42 |
| 50 public: | 43 public: |
| 51 IDBPendingTransactionMonitor(); | 44 IDBPendingTransactionMonitor(); |
| 52 ~IDBPendingTransactionMonitor(); | |
| 53 | 45 |
| 54 void addNewTransaction(IDBTransaction&); | 46 void addNewTransaction(IDBTransaction&); |
| 55 void deactivateNewTransactions(); | 47 void deactivateNewTransactions(); |
| 56 void registerRequest(IDBRequest&); | |
| 57 // It's ok to call unregisterRequest(*this) inside | |
| 58 // IDBRequest::dispose(). But we must not call unregisterRequest() with | |
| 59 // an object different from |this| of IDBRequest::dispose(). | |
| 60 void unregisterRequest(IDBRequest&); | |
| 61 void registerCursor(IDBCursor&); | |
| 62 // It's ok to call unregisterCursor(*this) inside IDBCursor::dispose(). But | |
| 63 // we must not call unregisterCursor() with an object different from |this| | |
| 64 // of IDBCursor::dispose(). | |
| 65 void unregisterCursor(IDBCursor&); | |
| 66 | 48 |
| 67 private: | 49 private: |
| 68 PersistentHeapVector<Member<IDBTransaction> > m_transactions; | 50 PersistentHeapVector<Member<IDBTransaction> > m_transactions; |
| 69 RefPtr<IDBDisposerDispatcher> m_dispatcher; | |
| 70 }; | 51 }; |
| 71 | 52 |
| 72 } // namespace blink | 53 } // namespace blink |
| 73 | 54 |
| 74 #endif // IDBPendingTransactionMonitor_h | 55 #endif // IDBPendingTransactionMonitor_h |
| OLD | NEW |