| OLD | NEW |
| 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 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 * | 25 * |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef DatabaseContext_h | 28 #ifndef DatabaseContext_h |
| 29 #define DatabaseContext_h | 29 #define DatabaseContext_h |
| 30 | 30 |
| 31 #include "core/dom/ActiveDOMObject.h" | 31 #include "core/dom/SuspendableObject.h" |
| 32 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class DatabaseContext; | 36 class DatabaseContext; |
| 37 class DatabaseThread; | 37 class DatabaseThread; |
| 38 class ExecutionContext; | 38 class ExecutionContext; |
| 39 class SecurityOrigin; | 39 class SecurityOrigin; |
| 40 | 40 |
| 41 class DatabaseContext final : public GarbageCollectedFinalized<DatabaseContext>, | 41 class DatabaseContext final : public GarbageCollectedFinalized<DatabaseContext>, |
| 42 public ActiveDOMObject { | 42 public SuspendableObject { |
| 43 USING_GARBAGE_COLLECTED_MIXIN(DatabaseContext); | 43 USING_GARBAGE_COLLECTED_MIXIN(DatabaseContext); |
| 44 | 44 |
| 45 public: | 45 public: |
| 46 friend class DatabaseManager; | 46 friend class DatabaseManager; |
| 47 | 47 |
| 48 static DatabaseContext* create(ExecutionContext*); | 48 static DatabaseContext* create(ExecutionContext*); |
| 49 | 49 |
| 50 ~DatabaseContext() override; | 50 ~DatabaseContext() override; |
| 51 DECLARE_VIRTUAL_TRACE(); | 51 DECLARE_VIRTUAL_TRACE(); |
| 52 | 52 |
| 53 // For life-cycle management (inherited from ActiveDOMObject): | 53 // For life-cycle management (inherited from SuspendableObject): |
| 54 void contextDestroyed() override; | 54 void contextDestroyed() override; |
| 55 | 55 |
| 56 DatabaseContext* backend(); | 56 DatabaseContext* backend(); |
| 57 DatabaseThread* databaseThread(); | 57 DatabaseThread* databaseThread(); |
| 58 bool databaseThreadAvailable(); | 58 bool databaseThreadAvailable(); |
| 59 | 59 |
| 60 void setHasOpenDatabases() { m_hasOpenDatabases = true; } | 60 void setHasOpenDatabases() { m_hasOpenDatabases = true; } |
| 61 // Blocks the caller thread until cleanup tasks are completed. | 61 // Blocks the caller thread until cleanup tasks are completed. |
| 62 void stopDatabases(); | 62 void stopDatabases(); |
| 63 | 63 |
| 64 bool allowDatabaseAccess() const; | 64 bool allowDatabaseAccess() const; |
| 65 | 65 |
| 66 SecurityOrigin* getSecurityOrigin() const; | 66 SecurityOrigin* getSecurityOrigin() const; |
| 67 bool isContextThread() const; | 67 bool isContextThread() const; |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 explicit DatabaseContext(ExecutionContext*); | 70 explicit DatabaseContext(ExecutionContext*); |
| 71 | 71 |
| 72 Member<DatabaseThread> m_databaseThread; | 72 Member<DatabaseThread> m_databaseThread; |
| 73 bool m_hasOpenDatabases; // This never changes back to false, even after the | 73 bool m_hasOpenDatabases; // This never changes back to false, even after the |
| 74 // database thread is closed. | 74 // database thread is closed. |
| 75 bool m_hasRequestedTermination; | 75 bool m_hasRequestedTermination; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace blink | 78 } // namespace blink |
| 79 | 79 |
| 80 #endif // DatabaseContext_h | 80 #endif // DatabaseContext_h |
| OLD | NEW |