| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class DatabaseAuthorizer; | 48 class DatabaseAuthorizer; |
| 49 class DatabaseContext; | 49 class DatabaseContext; |
| 50 class DatabaseBase; | 50 class DatabaseBase; |
| 51 class ExecutionContext; | 51 class ExecutionContext; |
| 52 class SecurityOrigin; | 52 class SecurityOrigin; |
| 53 | 53 |
| 54 // FIXME: This abstraction is unnecessary because DatabaseBackendSync was |
| 55 // removed. |
| 54 class DatabaseBackendBase : public ThreadSafeRefCountedWillBeGarbageCollectedFin
alized<DatabaseBackendBase> { | 56 class DatabaseBackendBase : public ThreadSafeRefCountedWillBeGarbageCollectedFin
alized<DatabaseBackendBase> { |
| 55 public: | 57 public: |
| 56 virtual ~DatabaseBackendBase(); | 58 virtual ~DatabaseBackendBase(); |
| 57 virtual void trace(Visitor*); | 59 virtual void trace(Visitor*); |
| 58 | 60 |
| 59 virtual String version() const; | 61 virtual String version() const; |
| 60 | 62 |
| 61 bool opened() const { return m_opened; } | 63 bool opened() const { return m_opened; } |
| 62 bool isNew() const { return m_new; } | 64 bool isNew() const { return m_new; } |
| 63 bool isSyncDatabase() const { return m_isSyncDatabase; } | |
| 64 | 65 |
| 65 virtual SecurityOrigin* securityOrigin() const; | 66 virtual SecurityOrigin* securityOrigin() const; |
| 66 virtual String stringIdentifier() const; | 67 virtual String stringIdentifier() const; |
| 67 virtual String displayName() const; | 68 virtual String displayName() const; |
| 68 virtual unsigned long estimatedSize() const; | 69 virtual unsigned long estimatedSize() const; |
| 69 virtual String fileName() const; | 70 virtual String fileName() const; |
| 70 SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; } | 71 SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; } |
| 71 | 72 |
| 72 unsigned long long maximumSize() const; | 73 unsigned long long maximumSize() const; |
| 73 void incrementalVacuumIfNeeded(); | 74 void incrementalVacuumIfNeeded(); |
| 74 void interrupt(); | |
| 75 bool isInterrupted(); | |
| 76 | 75 |
| 77 void disableAuthorizer(); | 76 void disableAuthorizer(); |
| 78 void enableAuthorizer(); | 77 void enableAuthorizer(); |
| 79 void setAuthorizerPermissions(int permissions); | 78 void setAuthorizerPermissions(int permissions); |
| 80 bool lastActionChangedDatabase(); | 79 bool lastActionChangedDatabase(); |
| 81 bool lastActionWasInsert(); | 80 bool lastActionWasInsert(); |
| 82 void resetDeletes(); | 81 void resetDeletes(); |
| 83 bool hadDeletes(); | 82 bool hadDeletes(); |
| 84 void resetAuthorizer(); | 83 void resetAuthorizer(); |
| 85 | 84 |
| 86 virtual void closeImmediately() = 0; | 85 virtual void closeImmediately() = 0; |
| 87 void closeDatabase(); | 86 void closeDatabase(); |
| 88 | 87 |
| 89 DatabaseContext* databaseContext() const { return m_databaseContext.get(); } | 88 DatabaseContext* databaseContext() const { return m_databaseContext.get(); } |
| 90 ExecutionContext* executionContext() const; | 89 ExecutionContext* executionContext() const; |
| 91 void setFrontend(DatabaseBase* frontend) { m_frontend = frontend; } | 90 void setFrontend(DatabaseBase* frontend) { m_frontend = frontend; } |
| 92 | 91 |
| 93 protected: | 92 protected: |
| 94 friend class ChangeVersionWrapper; | 93 friend class ChangeVersionWrapper; |
| 95 friend class SQLStatementBackend; | 94 friend class SQLStatementBackend; |
| 96 friend class SQLStatementSync; | |
| 97 friend class SQLTransactionBackend; | 95 friend class SQLTransactionBackend; |
| 98 friend class SQLTransactionBackendSync; | |
| 99 | 96 |
| 100 DatabaseBackendBase(DatabaseContext*, const String& name, const String& expe
ctedVersion, | 97 DatabaseBackendBase(DatabaseContext*, const String& name, const String& expe
ctedVersion, |
| 101 const String& displayName, unsigned long estimatedSize, DatabaseType); | 98 const String& displayName, unsigned long estimatedSize); |
| 102 | 99 |
| 103 virtual bool openAndVerifyVersion(bool setVersionInNewDatabase, DatabaseErro
r&, String& errorMessage) = 0; | 100 virtual bool openAndVerifyVersion(bool setVersionInNewDatabase, DatabaseErro
r&, String& errorMessage) = 0; |
| 104 virtual bool performOpenAndVerify(bool shouldSetVersionInNewDatabase, Databa
seError&, String& errorMessage); | 101 virtual bool performOpenAndVerify(bool shouldSetVersionInNewDatabase, Databa
seError&, String& errorMessage); |
| 105 | 102 |
| 106 bool getVersionFromDatabase(String& version, bool shouldCacheVersion = true)
; | 103 bool getVersionFromDatabase(String& version, bool shouldCacheVersion = true)
; |
| 107 bool setVersionInDatabase(const String& version, bool shouldCacheVersion = t
rue); | 104 bool setVersionInDatabase(const String& version, bool shouldCacheVersion = t
rue); |
| 108 void setExpectedVersion(const String&); | 105 void setExpectedVersion(const String&); |
| 109 const String& expectedVersion() const { return m_expectedVersion; } | 106 const String& expectedVersion() const { return m_expectedVersion; } |
| 110 String getCachedVersion()const; | 107 String getCachedVersion()const; |
| 111 void setCachedVersion(const String&); | 108 void setCachedVersion(const String&); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 132 DatabaseBase* m_frontend; | 129 DatabaseBase* m_frontend; |
| 133 | 130 |
| 134 #if !LOG_DISABLED || !ERROR_DISABLED | 131 #if !LOG_DISABLED || !ERROR_DISABLED |
| 135 String databaseDebugName() const { return m_contextThreadSecurityOrigin->toS
tring() + "::" + m_name; } | 132 String databaseDebugName() const { return m_contextThreadSecurityOrigin->toS
tring() + "::" + m_name; } |
| 136 #endif | 133 #endif |
| 137 | 134 |
| 138 private: | 135 private: |
| 139 DatabaseGuid m_guid; | 136 DatabaseGuid m_guid; |
| 140 bool m_opened; | 137 bool m_opened; |
| 141 bool m_new; | 138 bool m_new; |
| 142 const bool m_isSyncDatabase; | |
| 143 | 139 |
| 144 SQLiteDatabase m_sqliteDatabase; | 140 SQLiteDatabase m_sqliteDatabase; |
| 145 | 141 |
| 146 RefPtrWillBeMember<DatabaseAuthorizer> m_databaseAuthorizer; | 142 RefPtrWillBeMember<DatabaseAuthorizer> m_databaseAuthorizer; |
| 147 | 143 |
| 148 friend class DatabaseServer; | 144 friend class DatabaseServer; |
| 149 }; | 145 }; |
| 150 | 146 |
| 151 } // namespace blink | 147 } // namespace blink |
| 152 | 148 |
| 153 #endif // DatabaseBackendBase_h | 149 #endif // DatabaseBackendBase_h |
| OLD | NEW |