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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 SQLTransactionErrorCallback* callback, | 844 SQLTransactionErrorCallback* callback, |
845 std::unique_ptr<SQLErrorData> errorData) { | 845 std::unique_ptr<SQLErrorData> errorData) { |
846 callback->handleEvent(SQLError::create(*errorData)); | 846 callback->handleEvent(SQLError::create(*errorData)); |
847 } | 847 } |
848 | 848 |
849 void Database::runTransaction(SQLTransactionCallback* callback, | 849 void Database::runTransaction(SQLTransactionCallback* callback, |
850 SQLTransactionErrorCallback* errorCallback, | 850 SQLTransactionErrorCallback* errorCallback, |
851 VoidCallback* successCallback, | 851 VoidCallback* successCallback, |
852 bool readOnly, | 852 bool readOnly, |
853 const ChangeVersionData* changeVersionData) { | 853 const ChangeVersionData* changeVersionData) { |
| 854 if (!getExecutionContext()) |
| 855 return; |
| 856 |
854 ASSERT(getExecutionContext()->isContextThread()); | 857 ASSERT(getExecutionContext()->isContextThread()); |
855 // FIXME: Rather than passing errorCallback to SQLTransaction and then | 858 // FIXME: Rather than passing errorCallback to SQLTransaction and then |
856 // sometimes firing it ourselves, this code should probably be pushed down | 859 // sometimes firing it ourselves, this code should probably be pushed down |
857 // into Database so that we only create the SQLTransaction if we're | 860 // into Database so that we only create the SQLTransaction if we're |
858 // actually going to run it. | 861 // actually going to run it. |
859 #if ENABLE(ASSERT) | 862 #if ENABLE(ASSERT) |
860 SQLTransactionErrorCallback* originalErrorCallback = errorCallback; | 863 SQLTransactionErrorCallback* originalErrorCallback = errorCallback; |
861 #endif | 864 #endif |
862 SQLTransaction* transaction = SQLTransaction::create( | 865 SQLTransaction* transaction = SQLTransaction::create( |
863 this, callback, successCallback, errorCallback, readOnly); | 866 this, callback, successCallback, errorCallback, readOnly); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 if (getDatabaseContext()->databaseThread()->isDatabaseThread()) | 944 if (getDatabaseContext()->databaseThread()->isDatabaseThread()) |
942 return m_databaseThreadSecurityOrigin.get(); | 945 return m_databaseThreadSecurityOrigin.get(); |
943 return nullptr; | 946 return nullptr; |
944 } | 947 } |
945 | 948 |
946 bool Database::opened() { | 949 bool Database::opened() { |
947 return static_cast<bool>(acquireLoad(&m_opened)); | 950 return static_cast<bool>(acquireLoad(&m_opened)); |
948 } | 951 } |
949 | 952 |
950 } // namespace blink | 953 } // namespace blink |
OLD | NEW |