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

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

Issue 2698153003: Reduce createSameThreadTask usage in modules/ (Closed)
Patch Set: Move a static callback to an anonymous namespace Created 3 years, 10 months 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 SQLTransaction* transaction = SQLTransaction::create( 866 SQLTransaction* transaction = SQLTransaction::create(
867 this, callback, successCallback, errorCallback, readOnly); 867 this, callback, successCallback, errorCallback, readOnly);
868 SQLTransactionBackend* transactionBackend = 868 SQLTransactionBackend* transactionBackend =
869 runTransaction(transaction, readOnly, changeVersionData); 869 runTransaction(transaction, readOnly, changeVersionData);
870 if (!transactionBackend) { 870 if (!transactionBackend) {
871 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallback(); 871 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallback();
872 ASSERT(callback == originalErrorCallback); 872 ASSERT(callback == originalErrorCallback);
873 if (callback) { 873 if (callback) {
874 std::unique_ptr<SQLErrorData> error = SQLErrorData::create( 874 std::unique_ptr<SQLErrorData> error = SQLErrorData::create(
875 SQLError::kUnknownErr, "database has been closed"); 875 SQLError::kUnknownErr, "database has been closed");
876 getExecutionContext()->postTask( 876 TaskRunnerHelper::get(TaskType::DatabaseAccess, getExecutionContext())
877 TaskType::DatabaseAccess, BLINK_FROM_HERE, 877 ->postTask(BLINK_FROM_HERE, WTF::bind(&callTransactionErrorCallback,
878 createSameThreadTask(&callTransactionErrorCallback, 878 wrapPersistent(callback),
879 wrapPersistent(callback), 879 WTF::passed(std::move(error))));
880 WTF::passed(std::move(error))));
881 } 880 }
882 } 881 }
883 } 882 }
884 883
885 void Database::scheduleTransactionCallback(SQLTransaction* transaction) { 884 void Database::scheduleTransactionCallback(SQLTransaction* transaction) {
886 // The task is constructed in a database thread, and destructed in the 885 // The task is constructed in a database thread, and destructed in the
887 // context thread. 886 // context thread.
888 getExecutionContext()->postTask( 887 getExecutionContext()->postTask(
889 TaskType::DatabaseAccess, BLINK_FROM_HERE, 888 TaskType::DatabaseAccess, BLINK_FROM_HERE,
890 createCrossThreadTask(&SQLTransaction::performPendingCallback, 889 createCrossThreadTask(&SQLTransaction::performPendingCallback,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 if (getDatabaseContext()->databaseThread()->isDatabaseThread()) 945 if (getDatabaseContext()->databaseThread()->isDatabaseThread())
947 return m_databaseThreadSecurityOrigin.get(); 946 return m_databaseThreadSecurityOrigin.get();
948 return nullptr; 947 return nullptr;
949 } 948 }
950 949
951 bool Database::opened() { 950 bool Database::opened() {
952 return static_cast<bool>(acquireLoad(&m_opened)); 951 return static_cast<bool>(acquireLoad(&m_opened));
953 } 952 }
954 953
955 } // namespace blink 954 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698