Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 #ifndef DatabaseThread_h 28 #ifndef DatabaseThread_h
29 #define DatabaseThread_h 29 #define DatabaseThread_h
30 30
31 #include "platform/WebThreadSupportingGC.h" 31 #include "platform/WebThreadSupportingGC.h"
32 #include "platform/heap/Handle.h" 32 #include "platform/heap/Handle.h"
33 #include "wtf/HashMap.h" 33 #include "wtf/HashMap.h"
34 #include "wtf/OwnPtr.h"
35 #include "wtf/PassOwnPtr.h"
36 #include "wtf/ThreadingPrimitives.h" 34 #include "wtf/ThreadingPrimitives.h"
35 #include <memory>
37 36
38 namespace blink { 37 namespace blink {
39 38
40 class Database; 39 class Database;
41 class DatabaseTask; 40 class DatabaseTask;
42 class SQLTransactionClient; 41 class SQLTransactionClient;
43 class SQLTransactionCoordinator; 42 class SQLTransactionCoordinator;
44 class TaskSynchronizer; 43 class TaskSynchronizer;
45 44
46 class DatabaseThread : public GarbageCollectedFinalized<DatabaseThread> { 45 class DatabaseThread : public GarbageCollectedFinalized<DatabaseThread> {
47 public: 46 public:
48 static DatabaseThread* create() { return new DatabaseThread; } 47 static DatabaseThread* create() { return new DatabaseThread; }
49 ~DatabaseThread(); 48 ~DatabaseThread();
50 DECLARE_TRACE(); 49 DECLARE_TRACE();
51 50
52 // Callable only from the main thread. 51 // Callable only from the main thread.
53 void start(); 52 void start();
54 void terminate(); 53 void terminate();
55 54
56 // Callable from the main thread or the database thread. 55 // Callable from the main thread or the database thread.
57 void scheduleTask(PassOwnPtr<DatabaseTask>); 56 void scheduleTask(std::unique_ptr<DatabaseTask>);
58 bool isDatabaseThread() const; 57 bool isDatabaseThread() const;
59 58
60 // Callable only from the database thread. 59 // Callable only from the database thread.
61 void recordDatabaseOpen(Database*); 60 void recordDatabaseOpen(Database*);
62 void recordDatabaseClosed(Database*); 61 void recordDatabaseClosed(Database*);
63 bool isDatabaseOpen(Database*); 62 bool isDatabaseOpen(Database*);
64 63
65 SQLTransactionClient* transactionClient() { return m_transactionClient.get() ; } 64 SQLTransactionClient* transactionClient() { return m_transactionClient.get() ; }
66 SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCo ordinator.get(); } 65 SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCo ordinator.get(); }
67 66
68 private: 67 private:
69 DatabaseThread(); 68 DatabaseThread();
70 69
71 void setupDatabaseThread(); 70 void setupDatabaseThread();
72 void cleanupDatabaseThread(); 71 void cleanupDatabaseThread();
73 void cleanupDatabaseThreadCompleted(); 72 void cleanupDatabaseThreadCompleted();
74 73
75 OwnPtr<WebThreadSupportingGC> m_thread; 74 std::unique_ptr<WebThreadSupportingGC> m_thread;
76 75
77 // This set keeps track of the open databases that have been used on this th read. 76 // 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 77 // This must be updated in the database thread though it is constructed and
79 // destructed in the context thread. 78 // destructed in the context thread.
80 HashSet<CrossThreadPersistent<Database>> m_openDatabaseSet; 79 HashSet<CrossThreadPersistent<Database>> m_openDatabaseSet;
81 80
82 OwnPtr<SQLTransactionClient> m_transactionClient; 81 std::unique_ptr<SQLTransactionClient> m_transactionClient;
83 CrossThreadPersistent<SQLTransactionCoordinator> m_transactionCoordinator; 82 CrossThreadPersistent<SQLTransactionCoordinator> m_transactionCoordinator;
84 TaskSynchronizer* m_cleanupSync; 83 TaskSynchronizer* m_cleanupSync;
85 84
86 Mutex m_terminationRequestedMutex; 85 Mutex m_terminationRequestedMutex;
87 bool m_terminationRequested; 86 bool m_terminationRequested;
88 }; 87 };
89 88
90 } // namespace blink 89 } // namespace blink
91 90
92 #endif // DatabaseThread_h 91 #endif // DatabaseThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698