| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "wtf/Deque.h" | 36 #include "wtf/Deque.h" |
| 37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
| 38 #include "wtf/HashSet.h" | 38 #include "wtf/HashSet.h" |
| 39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 40 #include "wtf/text/StringHash.h" | 40 #include "wtf/text/StringHash.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class SQLTransactionBackend; | 44 class SQLTransactionBackend; |
| 45 | 45 |
| 46 class SQLTransactionCoordinator { | 46 class SQLTransactionCoordinator : public NoBaseWillBeGarbageCollected<SQLTransac
tionCoordinator> { |
| 47 WTF_MAKE_NONCOPYABLE(SQLTransactionCoordinator); WTF_MAKE_FAST_ALLOCATED; | 47 WTF_MAKE_NONCOPYABLE(SQLTransactionCoordinator); |
| 48 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 48 public: | 49 public: |
| 49 SQLTransactionCoordinator(); | 50 SQLTransactionCoordinator(); |
| 51 void trace(Visitor*); |
| 50 void acquireLock(SQLTransactionBackend*); | 52 void acquireLock(SQLTransactionBackend*); |
| 51 void releaseLock(SQLTransactionBackend*); | 53 void releaseLock(SQLTransactionBackend*); |
| 52 void shutdown(); | 54 void shutdown(); |
| 53 private: | 55 private: |
| 54 typedef Deque<RefPtrWillBeMember<SQLTransactionBackend> > TransactionsQueue; | 56 typedef Deque<RefPtrWillBeMember<SQLTransactionBackend> > TransactionsQueue; |
| 55 struct CoordinationInfo { | 57 struct CoordinationInfo { |
| 56 TransactionsQueue pendingTransactions; | 58 TransactionsQueue pendingTransactions; |
| 57 WillBeHeapHashSet<RefPtrWillBeMember<SQLTransactionBackend> > activeRead
Transactions; | 59 WillBeHeapHashSet<RefPtrWillBeMember<SQLTransactionBackend> > activeRead
Transactions; |
| 58 RefPtrWillBeMember<SQLTransactionBackend> activeWriteTransaction; | 60 RefPtrWillBeMember<SQLTransactionBackend> activeWriteTransaction; |
| 59 | 61 |
| 60 void trace(Visitor* visitor) | 62 void trace(Visitor* visitor) |
| 61 { | 63 { |
| 62 visitor->trace(pendingTransactions); | 64 visitor->trace(pendingTransactions); |
| 63 visitor->trace(activeReadTransactions); | 65 visitor->trace(activeReadTransactions); |
| 64 visitor->trace(activeWriteTransaction); | 66 visitor->trace(activeWriteTransaction); |
| 65 } | 67 } |
| 66 ALLOW_ONLY_INLINE_ALLOCATION(); | 68 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 67 }; | 69 }; |
| 68 // Maps database names to information about pending transactions | 70 // Maps database names to information about pending transactions |
| 69 typedef WillBePersistentHeapHashMap<String, CoordinationInfo> CoordinationIn
foHeapMap; | 71 typedef WillBeHeapHashMap<String, CoordinationInfo> CoordinationInfoHeapMap; |
| 70 CoordinationInfoHeapMap m_coordinationInfoMap; | 72 CoordinationInfoHeapMap m_coordinationInfoMap; |
| 71 bool m_isShuttingDown; | 73 bool m_isShuttingDown; |
| 72 | 74 |
| 73 void processPendingTransactions(CoordinationInfo&); | 75 void processPendingTransactions(CoordinationInfo&); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace WebCore | 78 } // namespace WebCore |
| 77 | 79 |
| 78 #endif // SQLTransactionCoordinator_h | 80 #endif // SQLTransactionCoordinator_h |
| OLD | NEW |