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 GarbageCollected<SQLTransactionCoordina
tor> { | 45 class SQLTransactionCoordinator : public GarbageCollectedFinalized<SQLTransactio
nCoordinator> { |
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 HeapDeque<Member<SQLTransactionBackend>> TransactionsQueue; | 55 typedef Deque<CrossThreadPersistent<SQLTransactionBackend>> TransactionsQueu
e; |
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 HeapHashSet<Member<SQLTransactionBackend>> activeReadTransactions; | 60 HashSet<CrossThreadPersistent<SQLTransactionBackend>> activeReadTransact
ions; |
61 Member<SQLTransactionBackend> activeWriteTransaction; | 61 CrossThreadPersistent<SQLTransactionBackend> activeWriteTransaction; |
62 | |
63 DEFINE_INLINE_TRACE() | |
64 { | |
65 visitor->trace(pendingTransactions); | |
66 visitor->trace(activeReadTransactions); | |
67 visitor->trace(activeWriteTransaction); | |
68 } | |
69 }; | 62 }; |
70 // Maps database names to information about pending transactions | 63 // Maps database names to information about pending transactions |
71 typedef HeapHashMap<String, CoordinationInfo> CoordinationInfoHeapMap; | 64 typedef HashMap<String, CoordinationInfo> CoordinationInfoHeapMap; |
72 CoordinationInfoHeapMap m_coordinationInfoMap; | 65 CoordinationInfoHeapMap m_coordinationInfoMap; |
73 bool m_isShuttingDown; | 66 bool m_isShuttingDown; |
74 | 67 |
75 void processPendingTransactions(CoordinationInfo&); | 68 void processPendingTransactions(CoordinationInfo&); |
76 }; | 69 }; |
77 | 70 |
78 } // namespace blink | 71 } // namespace blink |
79 | 72 |
80 #endif // SQLTransactionCoordinator_h | 73 #endif // SQLTransactionCoordinator_h |
OLD | NEW |