OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 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 * | 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void terminate(); | 54 void terminate(); |
55 | 55 |
56 // Callable from the main thread or the database thread. | 56 // Callable from the main thread or the database thread. |
57 void scheduleTask(PassOwnPtr<DatabaseTask>); | 57 void scheduleTask(PassOwnPtr<DatabaseTask>); |
58 bool isDatabaseThread() const; | 58 bool isDatabaseThread() const; |
59 | 59 |
60 // Callable only from the database thread. | 60 // Callable only from the database thread. |
61 void recordDatabaseOpen(Database*); | 61 void recordDatabaseOpen(Database*); |
62 void recordDatabaseClosed(Database*); | 62 void recordDatabaseClosed(Database*); |
63 bool isDatabaseOpen(Database*); | 63 bool isDatabaseOpen(Database*); |
| 64 bool isDatabaseOpen(CrossThreadPersistent<Database>); |
64 | 65 |
65 SQLTransactionClient* transactionClient() { return m_transactionClient.get()
; } | 66 SQLTransactionClient* transactionClient() { return m_transactionClient.get()
; } |
66 SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCo
ordinator.get(); } | 67 CrossThreadPersistent<SQLTransactionCoordinator>& transactionCoordinator() {
return m_transactionCoordinator; } |
67 | 68 |
68 private: | 69 private: |
69 DatabaseThread(); | 70 DatabaseThread(); |
70 | 71 |
71 void setupDatabaseThread(); | 72 void setupDatabaseThread(); |
72 void cleanupDatabaseThread(); | 73 void cleanupDatabaseThread(); |
73 void cleanupDatabaseThreadCompleted(); | 74 void cleanupDatabaseThreadCompleted(); |
74 | 75 |
75 OwnPtr<WebThreadSupportingGC> m_thread; | 76 OwnPtr<WebThreadSupportingGC> m_thread; |
76 | 77 |
77 // This set keeps track of the open databases that have been used on this th
read. | 78 // This set keeps track of the open databases that have been used on this th
read. |
78 // This must be updated in the database thread though it is constructed and | 79 // This must be updated in the database thread though it is constructed and |
79 // destructed in the context thread. | 80 // destructed in the context thread. |
80 HashSet<CrossThreadPersistent<Database>> m_openDatabaseSet; | 81 HashSet<CrossThreadPersistent<Database>> m_openDatabaseSet; |
81 | 82 |
82 OwnPtr<SQLTransactionClient> m_transactionClient; | 83 OwnPtr<SQLTransactionClient> m_transactionClient; |
83 CrossThreadPersistent<SQLTransactionCoordinator> m_transactionCoordinator; | 84 CrossThreadPersistent<SQLTransactionCoordinator> m_transactionCoordinator; |
84 TaskSynchronizer* m_cleanupSync; | 85 TaskSynchronizer* m_cleanupSync; |
85 | 86 |
86 Mutex m_terminationRequestedMutex; | 87 Mutex m_terminationRequestedMutex; |
87 bool m_terminationRequested; | 88 bool m_terminationRequested; |
88 }; | 89 }; |
89 | 90 |
90 } // namespace blink | 91 } // namespace blink |
91 | 92 |
92 #endif // DatabaseThread_h | 93 #endif // DatabaseThread_h |
OLD | NEW |