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

Side by Side Diff: Source/modules/webdatabase/DatabaseContext.h

Issue 215063005: Oilpan: Prepare to move DatabaseContext to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. 3 * Copyright (C) 2011 Google, 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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 25 matching lines...) Expand all
36 namespace WebCore { 36 namespace WebCore {
37 37
38 class Database; 38 class Database;
39 class DatabaseBackendBase; 39 class DatabaseBackendBase;
40 class DatabaseContext; 40 class DatabaseContext;
41 class DatabaseTaskSynchronizer; 41 class DatabaseTaskSynchronizer;
42 class DatabaseThread; 42 class DatabaseThread;
43 class ExecutionContext; 43 class ExecutionContext;
44 class SecurityOrigin; 44 class SecurityOrigin;
45 45
46 class DatabaseContext FINAL : public ThreadSafeRefCounted<DatabaseContext>, publ ic ActiveDOMObject { 46 class DatabaseContext FINAL : public ThreadSafeRefCountedWillBeGarbageCollectedF inalized<DatabaseContext>, public ActiveDOMObject {
47 public: 47 public:
48 friend class DatabaseManager; 48 friend class DatabaseManager;
49 49
50 static PassRefPtr<DatabaseContext> create(ExecutionContext*); 50 static PassRefPtrWillBeRawPtr<DatabaseContext> create(ExecutionContext*);
51 51
52 virtual ~DatabaseContext(); 52 virtual ~DatabaseContext();
53 void trace(Visitor*);
53 54
54 // For life-cycle management (inherited from ActiveDOMObject): 55 // For life-cycle management (inherited from ActiveDOMObject):
55 virtual void contextDestroyed() OVERRIDE; 56 virtual void contextDestroyed() OVERRIDE;
56 virtual void willStop() OVERRIDE; 57 virtual void willStop() OVERRIDE;
57 virtual void stop() OVERRIDE; 58 virtual void stop() OVERRIDE;
58 59
59 DatabaseContext* backend(); 60 DatabaseContext* backend();
60 DatabaseThread* databaseThread(); 61 DatabaseThread* databaseThread();
61 62
62 void setHasOpenDatabases() { m_hasOpenDatabases = true; } 63 void setHasOpenDatabases() { m_hasOpenDatabases = true; }
63 void didOpenDatabase(DatabaseBackendBase&); 64 void didOpenDatabase(DatabaseBackendBase&);
64 void didCloseDatabase(DatabaseBackendBase&); 65 void didCloseDatabase(DatabaseBackendBase&);
65 // Blocks the caller thread until cleanup tasks are completed. 66 // Blocks the caller thread until cleanup tasks are completed.
66 void stopDatabases(); 67 void stopDatabases();
67 68
68 bool allowDatabaseAccess() const; 69 bool allowDatabaseAccess() const;
69 70
70 SecurityOrigin* securityOrigin() const; 71 SecurityOrigin* securityOrigin() const;
71 bool isContextThread() const; 72 bool isContextThread() const;
72 73
73 private: 74 private:
74 explicit DatabaseContext(ExecutionContext*); 75 explicit DatabaseContext(ExecutionContext*);
75 76
76 void stopSyncDatabases(); 77 void stopSyncDatabases();
77 78
78 RefPtrWillBePersistent<DatabaseThread> m_databaseThread; 79 RefPtrWillBeMember<DatabaseThread> m_databaseThread;
79 #if ENABLE(OILPAN) 80 #if ENABLE(OILPAN)
80 class DatabaseCloser { 81 class DatabaseCloser {
81 public: 82 public:
82 explicit DatabaseCloser(DatabaseBackendBase& database) : m_database(data base) { } 83 explicit DatabaseCloser(DatabaseBackendBase& database) : m_database(data base) { }
83 ~DatabaseCloser(); 84 ~DatabaseCloser();
84 85
85 private: 86 private:
86 DatabaseBackendBase& m_database; 87 DatabaseBackendBase& m_database;
87 }; 88 };
88 PersistentHeapHashMap<WeakMember<DatabaseBackendBase>, OwnPtr<DatabaseCloser > > m_openSyncDatabases; 89 HeapHashMap<WeakMember<DatabaseBackendBase>, OwnPtr<DatabaseCloser> > m_open SyncDatabases;
89 #else 90 #else
90 // The contents of m_openSyncDatabases are raw pointers. It's safe because 91 // The contents of m_openSyncDatabases are raw pointers. It's safe because
91 // DatabaseBackendSync is always closed before destruction. 92 // DatabaseBackendSync is always closed before destruction.
92 HashSet<DatabaseBackendBase*> m_openSyncDatabases; 93 HashSet<DatabaseBackendBase*> m_openSyncDatabases;
93 #endif 94 #endif
94 bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed. 95 bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed.
95 bool m_hasRequestedTermination; 96 bool m_hasRequestedTermination;
96 }; 97 };
97 98
98 } // namespace WebCore 99 } // namespace WebCore
99 100
100 #endif // DatabaseContext_h 101 #endif // DatabaseContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698