OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #endif | 59 #endif |
60 }; | 60 }; |
61 | 61 |
62 #if DCHECK_IS_ON() | 62 #if DCHECK_IS_ON() |
63 extern const char* nameForSQLTransactionState(SQLTransactionState); | 63 extern const char* nameForSQLTransactionState(SQLTransactionState); |
64 #endif | 64 #endif |
65 | 65 |
66 template <typename T> | 66 template <typename T> |
67 SQLTransactionStateMachine<T>::SQLTransactionStateMachine() | 67 SQLTransactionStateMachine<T>::SQLTransactionStateMachine() |
68 : m_nextState(SQLTransactionState::Idle), | 68 : m_nextState(SQLTransactionState::Idle), |
69 m_requestedState(SQLTransactionState::Idle) | 69 m_requestedState(SQLTransactionState::Idle) { |
70 { | |
71 #if DCHECK_IS_ON() | 70 #if DCHECK_IS_ON() |
72 for (int i = 0; i < s_sizeOfStateAuditTrail; i++) | 71 for (int i = 0; i < s_sizeOfStateAuditTrail; i++) |
73 m_stateAuditTrail[i] = SQLTransactionState::NumberOfStates; | 72 m_stateAuditTrail[i] = SQLTransactionState::NumberOfStates; |
74 #endif | 73 #endif |
75 } | 74 } |
76 | 75 |
77 template <typename T> | 76 template <typename T> |
78 void SQLTransactionStateMachine<T>::setStateToRequestedState() { | 77 void SQLTransactionStateMachine<T>::setStateToRequestedState() { |
79 ASSERT(m_nextState == SQLTransactionState::Idle); | 78 ASSERT(m_nextState == SQLTransactionState::Idle); |
80 ASSERT(m_requestedState != SQLTransactionState::Idle); | 79 ASSERT(m_requestedState != SQLTransactionState::Idle); |
(...skipping 14 matching lines...) Expand all Loading... |
95 m_nextStateAuditEntry = | 94 m_nextStateAuditEntry = |
96 (m_nextStateAuditEntry + 1) % s_sizeOfStateAuditTrail; | 95 (m_nextStateAuditEntry + 1) % s_sizeOfStateAuditTrail; |
97 #endif | 96 #endif |
98 m_nextState = (static_cast<T*>(this)->*stateFunction)(); | 97 m_nextState = (static_cast<T*>(this)->*stateFunction)(); |
99 } | 98 } |
100 } | 99 } |
101 | 100 |
102 } // namespace blink | 101 } // namespace blink |
103 | 102 |
104 #endif // SQLTransactionStateMachine_h | 103 #endif // SQLTransactionStateMachine_h |
OLD | NEW |