| 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 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/text/StringHash.h" | 39 #include "wtf/text/StringHash.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class SQLTransactionBackend; | 43 class SQLTransactionBackend; |
| 44 | 44 |
| 45 class SQLTransactionCoordinator : public GarbageCollectedFinalized<SQLTransactio
nCoordinator> { | 45 class SQLTransactionCoordinator : public GarbageCollected<SQLTransactionCoordina
tor> { |
| 46 WTF_MAKE_NONCOPYABLE(SQLTransactionCoordinator); | 46 WTF_MAKE_NONCOPYABLE(SQLTransactionCoordinator); |
| 47 public: | 47 public: |
| 48 SQLTransactionCoordinator(); | 48 SQLTransactionCoordinator(); |
| 49 DECLARE_TRACE(); | 49 DECLARE_TRACE(); |
| 50 void acquireLock(SQLTransactionBackend*); | 50 void acquireLock(SQLTransactionBackend*); |
| 51 void releaseLock(SQLTransactionBackend*); | 51 void releaseLock(SQLTransactionBackend*); |
| 52 void shutdown(); | 52 void shutdown(); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 typedef Deque<CrossThreadPersistent<SQLTransactionBackend>> TransactionsQueu
e; | 55 typedef HeapDeque<Member<SQLTransactionBackend>> TransactionsQueue; |
| 56 struct CoordinationInfo { | 56 struct CoordinationInfo { |
| 57 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 57 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 58 public: | 58 public: |
| 59 TransactionsQueue pendingTransactions; | 59 TransactionsQueue pendingTransactions; |
| 60 HashSet<CrossThreadPersistent<SQLTransactionBackend>> activeReadTransact
ions; | 60 HeapHashSet<Member<SQLTransactionBackend>> activeReadTransactions; |
| 61 CrossThreadPersistent<SQLTransactionBackend> activeWriteTransaction; | 61 Member<SQLTransactionBackend> activeWriteTransaction; |
| 62 |
| 63 DEFINE_INLINE_TRACE() |
| 64 { |
| 65 visitor->trace(pendingTransactions); |
| 66 visitor->trace(activeReadTransactions); |
| 67 visitor->trace(activeWriteTransaction); |
| 68 } |
| 62 }; | 69 }; |
| 63 // Maps database names to information about pending transactions | 70 // Maps database names to information about pending transactions |
| 64 typedef HashMap<String, CoordinationInfo> CoordinationInfoHeapMap; | 71 typedef HeapHashMap<String, CoordinationInfo> CoordinationInfoHeapMap; |
| 65 CoordinationInfoHeapMap m_coordinationInfoMap; | 72 CoordinationInfoHeapMap m_coordinationInfoMap; |
| 66 bool m_isShuttingDown; | 73 bool m_isShuttingDown; |
| 67 | 74 |
| 68 void processPendingTransactions(CoordinationInfo&); | 75 void processPendingTransactions(CoordinationInfo&); |
| 69 }; | 76 }; |
| 70 | 77 |
| 71 } // namespace blink | 78 } // namespace blink |
| 72 | 79 |
| 73 #endif // SQLTransactionCoordinator_h | 80 #endif // SQLTransactionCoordinator_h |
| OLD | NEW |