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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 | 44 |
45 class DatabaseBackend; | 45 class DatabaseBackend; |
46 class DatabaseTask; | 46 class DatabaseTask; |
47 class DatabaseTaskSynchronizer; | 47 class DatabaseTaskSynchronizer; |
48 class Document; | 48 class Document; |
49 class MessageLoopInterruptor; | 49 class MessageLoopInterruptor; |
50 class PendingGCRunner; | 50 class PendingGCRunner; |
51 class SQLTransactionClient; | 51 class SQLTransactionClient; |
52 class SQLTransactionCoordinator; | 52 class SQLTransactionCoordinator; |
53 | 53 |
54 class DatabaseThread : public ThreadSafeRefCounted<DatabaseThread> { | 54 class DatabaseThread : public ThreadSafeRefCountedWillBeGarbageCollectedFinalize d<DatabaseThread> { |
55 public: | 55 public: |
56 static PassRefPtr<DatabaseThread> create() { return adoptRef(new DatabaseThr ead); } | 56 static PassRefPtrWillBeRawPtr<DatabaseThread> create() { return adoptRefWill BeNoop(new DatabaseThread); } |
57 ~DatabaseThread(); | 57 ~DatabaseThread(); |
58 void trace(Visitor*); | |
58 | 59 |
59 void start(); | 60 void start(); |
60 void requestTermination(DatabaseTaskSynchronizer* cleanupSync); | 61 void requestTermination(DatabaseTaskSynchronizer* cleanupSync); |
61 bool terminationRequested(DatabaseTaskSynchronizer* taskSynchronizer = 0) co nst; | 62 bool terminationRequested(DatabaseTaskSynchronizer* taskSynchronizer = 0) co nst; |
62 | 63 |
63 void scheduleTask(PassOwnPtr<DatabaseTask>); | 64 void scheduleTask(PassOwnPtr<DatabaseTask>); |
64 | 65 |
65 void recordDatabaseOpen(DatabaseBackend*); | 66 void recordDatabaseOpen(DatabaseBackend*); |
66 void recordDatabaseClosed(DatabaseBackend*); | 67 void recordDatabaseClosed(DatabaseBackend*); |
67 bool isDatabaseOpen(DatabaseBackend*); | 68 bool isDatabaseOpen(DatabaseBackend*); |
68 | 69 |
69 bool isDatabaseThread() { return m_thread && m_thread->isCurrentThread(); } | 70 bool isDatabaseThread() { return m_thread && m_thread->isCurrentThread(); } |
70 | 71 |
71 SQLTransactionClient* transactionClient() { return m_transactionClient.get() ; } | 72 SQLTransactionClient* transactionClient() { return m_transactionClient.get() ; } |
72 SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCo ordinator.get(); } | 73 SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCo ordinator.get(); } |
73 | 74 |
74 private: | 75 private: |
75 DatabaseThread(); | 76 DatabaseThread(); |
76 | 77 |
77 void setupDatabaseThread(); | 78 void setupDatabaseThread(); |
78 void cleanupDatabaseThread(); | 79 void cleanupDatabaseThread(); |
79 void cleanupDatabaseThreadCompleted(); | 80 void cleanupDatabaseThreadCompleted(); |
80 | 81 |
81 OwnPtr<blink::WebThread> m_thread; | 82 OwnPtr<blink::WebThread> m_thread; |
82 | 83 |
83 // This set keeps track of the open databases that have been used on this th read. | 84 // This set keeps track of the open databases that have been used on this th read. |
84 // This must be updated in the database thread though it is constructed and | 85 // This must be updated in the database thread though it is constructed and |
85 // destructed in the context thread. | 86 // destructed in the context thread. |
86 WillBePersistentHeapHashSet<RefPtrWillBeMember<DatabaseBackend> > m_openData baseSet; | 87 WillBeHeapHashSet<RefPtrWillBeMember<DatabaseBackend> > m_openDatabaseSet; |
87 | 88 |
88 OwnPtr<SQLTransactionClient> m_transactionClient; | 89 OwnPtr<SQLTransactionClient> m_transactionClient; |
89 OwnPtr<SQLTransactionCoordinator> m_transactionCoordinator; | 90 OwnPtrWillBeMember<SQLTransactionCoordinator> m_transactionCoordinator; |
90 DatabaseTaskSynchronizer* m_cleanupSync; | 91 DatabaseTaskSynchronizer* m_cleanupSync; |
haraken
2014/03/19 09:42:45
This raw pointer looks safe.
| |
91 | 92 |
92 mutable Mutex m_terminationRequestedMutex; | 93 mutable Mutex m_terminationRequestedMutex; |
93 bool m_terminationRequested; | 94 bool m_terminationRequested; |
94 OwnPtr<PendingGCRunner> m_pendingGCRunner; | 95 OwnPtr<PendingGCRunner> m_pendingGCRunner; |
95 OwnPtr<MessageLoopInterruptor> m_messageLoopInterruptor; | 96 OwnPtr<MessageLoopInterruptor> m_messageLoopInterruptor; |
96 }; | 97 }; |
97 | 98 |
98 } // namespace WebCore | 99 } // namespace WebCore |
99 | 100 |
100 #endif // DatabaseThread_h | 101 #endif // DatabaseThread_h |
OLD | NEW |