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

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/Database.cpp

Issue 2584263002: Specify TaskType of posted Task explicitly in WebSQL (9) (Closed)
Patch Set: rebase Created 4 years 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
OLDNEW
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 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "modules/webdatabase/Database.h" 26 #include "modules/webdatabase/Database.h"
27 27
28 #include "core/dom/ExceptionCode.h" 28 #include "core/dom/ExceptionCode.h"
29 #include "core/dom/ExecutionContext.h" 29 #include "core/dom/ExecutionContext.h"
30 #include "core/dom/ExecutionContextTask.h" 30 #include "core/dom/ExecutionContextTask.h"
31 #include "core/dom/TaskRunnerHelper.h"
31 #include "core/html/VoidCallback.h" 32 #include "core/html/VoidCallback.h"
32 #include "core/inspector/ConsoleMessage.h" 33 #include "core/inspector/ConsoleMessage.h"
33 #include "modules/webdatabase/ChangeVersionData.h" 34 #include "modules/webdatabase/ChangeVersionData.h"
34 #include "modules/webdatabase/ChangeVersionWrapper.h" 35 #include "modules/webdatabase/ChangeVersionWrapper.h"
35 #include "modules/webdatabase/DatabaseAuthorizer.h" 36 #include "modules/webdatabase/DatabaseAuthorizer.h"
36 #include "modules/webdatabase/DatabaseContext.h" 37 #include "modules/webdatabase/DatabaseContext.h"
37 #include "modules/webdatabase/DatabaseManager.h" 38 #include "modules/webdatabase/DatabaseManager.h"
38 #include "modules/webdatabase/DatabaseTask.h" 39 #include "modules/webdatabase/DatabaseTask.h"
39 #include "modules/webdatabase/DatabaseThread.h" 40 #include "modules/webdatabase/DatabaseThread.h"
40 #include "modules/webdatabase/DatabaseTracker.h" 41 #include "modules/webdatabase/DatabaseTracker.h"
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 this, callback, successCallback, errorCallback, readOnly); 867 this, callback, successCallback, errorCallback, readOnly);
867 SQLTransactionBackend* transactionBackend = 868 SQLTransactionBackend* transactionBackend =
868 runTransaction(transaction, readOnly, changeVersionData); 869 runTransaction(transaction, readOnly, changeVersionData);
869 if (!transactionBackend) { 870 if (!transactionBackend) {
870 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallback(); 871 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallback();
871 ASSERT(callback == originalErrorCallback); 872 ASSERT(callback == originalErrorCallback);
872 if (callback) { 873 if (callback) {
873 std::unique_ptr<SQLErrorData> error = SQLErrorData::create( 874 std::unique_ptr<SQLErrorData> error = SQLErrorData::create(
874 SQLError::kUnknownErr, "database has been closed"); 875 SQLError::kUnknownErr, "database has been closed");
875 getExecutionContext()->postTask( 876 getExecutionContext()->postTask(
876 BLINK_FROM_HERE, createSameThreadTask(&callTransactionErrorCallback, 877 TaskType::DatabaseAccess, BLINK_FROM_HERE,
877 wrapPersistent(callback), 878 createSameThreadTask(&callTransactionErrorCallback,
878 WTF::passed(std::move(error)))); 879 wrapPersistent(callback),
880 WTF::passed(std::move(error))));
879 } 881 }
880 } 882 }
881 } 883 }
882 884
883 void Database::scheduleTransactionCallback(SQLTransaction* transaction) { 885 void Database::scheduleTransactionCallback(SQLTransaction* transaction) {
884 // The task is constructed in a database thread, and destructed in the 886 // The task is constructed in a database thread, and destructed in the
885 // context thread. 887 // context thread.
886 getExecutionContext()->postTask( 888 getExecutionContext()->postTask(
887 BLINK_FROM_HERE, 889 TaskType::DatabaseAccess, BLINK_FROM_HERE,
888 createCrossThreadTask(&SQLTransaction::performPendingCallback, 890 createCrossThreadTask(&SQLTransaction::performPendingCallback,
889 wrapCrossThreadPersistent(transaction))); 891 wrapCrossThreadPersistent(transaction)));
890 } 892 }
891 893
892 Vector<String> Database::performGetTableNames() { 894 Vector<String> Database::performGetTableNames() {
893 disableAuthorizer(); 895 disableAuthorizer();
894 896
895 SQLiteStatement statement( 897 SQLiteStatement statement(
896 sqliteDatabase(), "SELECT name FROM sqlite_master WHERE type='table';"); 898 sqliteDatabase(), "SELECT name FROM sqlite_master WHERE type='table';");
897 if (statement.prepare() != SQLResultOk) { 899 if (statement.prepare() != SQLResultOk) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 if (getDatabaseContext()->databaseThread()->isDatabaseThread()) 946 if (getDatabaseContext()->databaseThread()->isDatabaseThread())
945 return m_databaseThreadSecurityOrigin.get(); 947 return m_databaseThreadSecurityOrigin.get();
946 return nullptr; 948 return nullptr;
947 } 949 }
948 950
949 bool Database::opened() { 951 bool Database::opened() {
950 return static_cast<bool>(acquireLoad(&m_opened)); 952 return static_cast<bool>(acquireLoad(&m_opened));
951 } 953 }
952 954
953 } // namespace blink 955 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698