| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 #if ENABLE(ASSERT) | 833 #if ENABLE(ASSERT) |
| 834 SQLTransactionErrorCallback* originalErrorCallback = errorCallback; | 834 SQLTransactionErrorCallback* originalErrorCallback = errorCallback; |
| 835 #endif | 835 #endif |
| 836 SQLTransaction* transaction = SQLTransaction::create(this, callback, success
Callback, errorCallback, readOnly); | 836 SQLTransaction* transaction = SQLTransaction::create(this, callback, success
Callback, errorCallback, readOnly); |
| 837 SQLTransactionBackend* transactionBackend = runTransaction(transaction, read
Only, changeVersionData); | 837 SQLTransactionBackend* transactionBackend = runTransaction(transaction, read
Only, changeVersionData); |
| 838 if (!transactionBackend) { | 838 if (!transactionBackend) { |
| 839 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallbac
k(); | 839 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallbac
k(); |
| 840 ASSERT(callback == originalErrorCallback); | 840 ASSERT(callback == originalErrorCallback); |
| 841 if (callback) { | 841 if (callback) { |
| 842 OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_
ERR, "database has been closed"); | 842 OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_
ERR, "database has been closed"); |
| 843 executionContext()->postTask(createSameThreadTask(&callTransactionEr
rorCallback, callback, error.release())); | 843 executionContext()->postTask(FROM_HERE, createSameThreadTask(&callTr
ansactionErrorCallback, callback, error.release())); |
| 844 } | 844 } |
| 845 } | 845 } |
| 846 } | 846 } |
| 847 | 847 |
| 848 // This object is constructed in a database thread, and destructed in the | 848 // This object is constructed in a database thread, and destructed in the |
| 849 // context thread. | 849 // context thread. |
| 850 class DeliverPendingCallbackTask final : public ExecutionContextTask { | 850 class DeliverPendingCallbackTask final : public ExecutionContextTask { |
| 851 public: | 851 public: |
| 852 static PassOwnPtr<DeliverPendingCallbackTask> create(SQLTransaction* transac
tion) | 852 static PassOwnPtr<DeliverPendingCallbackTask> create(SQLTransaction* transac
tion) |
| 853 { | 853 { |
| 854 return adoptPtr(new DeliverPendingCallbackTask(transaction)); | 854 return adoptPtr(new DeliverPendingCallbackTask(transaction)); |
| 855 } | 855 } |
| 856 | 856 |
| 857 virtual void performTask(ExecutionContext*) override | 857 virtual void performTask(ExecutionContext*) override |
| 858 { | 858 { |
| 859 m_transaction->performPendingCallback(); | 859 m_transaction->performPendingCallback(); |
| 860 } | 860 } |
| 861 | 861 |
| 862 private: | 862 private: |
| 863 DeliverPendingCallbackTask(SQLTransaction* transaction) | 863 DeliverPendingCallbackTask(SQLTransaction* transaction) |
| 864 : m_transaction(transaction) | 864 : m_transaction(transaction) |
| 865 { | 865 { |
| 866 } | 866 } |
| 867 | 867 |
| 868 CrossThreadPersistent<SQLTransaction> m_transaction; | 868 CrossThreadPersistent<SQLTransaction> m_transaction; |
| 869 }; | 869 }; |
| 870 | 870 |
| 871 void Database::scheduleTransactionCallback(SQLTransaction* transaction) | 871 void Database::scheduleTransactionCallback(SQLTransaction* transaction) |
| 872 { | 872 { |
| 873 executionContext()->postTask(DeliverPendingCallbackTask::create(transaction)
); | 873 executionContext()->postTask(FROM_HERE, DeliverPendingCallbackTask::create(t
ransaction)); |
| 874 } | 874 } |
| 875 | 875 |
| 876 Vector<String> Database::performGetTableNames() | 876 Vector<String> Database::performGetTableNames() |
| 877 { | 877 { |
| 878 disableAuthorizer(); | 878 disableAuthorizer(); |
| 879 | 879 |
| 880 SQLiteStatement statement(sqliteDatabase(), "SELECT name FROM sqlite_master
WHERE type='table';"); | 880 SQLiteStatement statement(sqliteDatabase(), "SELECT name FROM sqlite_master
WHERE type='table';"); |
| 881 if (statement.prepare() != SQLResultOk) { | 881 if (statement.prepare() != SQLResultOk) { |
| 882 WTF_LOG_ERROR("Unable to retrieve list of tables for database %s", datab
aseDebugName().ascii().data()); | 882 WTF_LOG_ERROR("Unable to retrieve list of tables for database %s", datab
aseDebugName().ascii().data()); |
| 883 enableAuthorizer(); | 883 enableAuthorizer(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 SecurityOrigin* Database::securityOrigin() const | 922 SecurityOrigin* Database::securityOrigin() const |
| 923 { | 923 { |
| 924 if (executionContext()->isContextThread()) | 924 if (executionContext()->isContextThread()) |
| 925 return m_contextThreadSecurityOrigin.get(); | 925 return m_contextThreadSecurityOrigin.get(); |
| 926 if (databaseContext()->databaseThread()->isDatabaseThread()) | 926 if (databaseContext()->databaseThread()->isDatabaseThread()) |
| 927 return m_databaseThreadSecurityOrigin.get(); | 927 return m_databaseThreadSecurityOrigin.get(); |
| 928 return 0; | 928 return 0; |
| 929 } | 929 } |
| 930 | 930 |
| 931 } // namespace blink | 931 } // namespace blink |
| OLD | NEW |