[Web IDL] Specify default parameter values for callback parameters
https://bugs.webkit.org/show_bug.cgi?id=157188
Reviewed by Darin Adler.
Specify default parameter values for callback parameters.
* Modules/geolocation/Geolocation.idl:
* Modules/notifications/Notification.cpp:
(WebCore::Notification::requestPermission):
* Modules/notifications/Notification.h:
* Modules/notifications/Notification.idl:
* Modules/notifications/NotificationCenter.idl:
* Modules/quota/StorageInfo.cpp:
(WebCore::StorageInfo::queryUsageAndQuota):
(WebCore::StorageInfo::requestQuota):
* Modules/quota/StorageInfo.h:
* Modules/quota/StorageInfo.idl:
* Modules/quota/StorageQuota.h:
* Modules/quota/StorageQuota.idl:
* Modules/webaudio/AudioContext.idl:
* Modules/webdatabase/DOMWindowWebDatabase.cpp:
(WebCore::DOMWindowWebDatabase::openDatabase):
* Modules/webdatabase/DOMWindowWebDatabase.h:
(WebCore::DOMWindowWebDatabase::DOMWindowWebDatabase):
(WebCore::DOMWindowWebDatabase::~DOMWindowWebDatabase):
* Modules/webdatabase/DOMWindowWebDatabase.idl:
* Modules/webdatabase/Database.cpp:
(WebCore::Database::runTransaction):
(WebCore::Database::changeVersion):
(WebCore::Database::transaction):
(WebCore::Database::readTransaction):
* Modules/webdatabase/Database.h:
* Modules/webdatabase/Database.idl:
* Modules/webdatabase/SQLTransaction.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
(CanUseWTFOptionalForParameter): Deleted.
* bindings/scripts/test/TestObj.idl:
* dom/DataTransferItem.h:
* dom/DataTransferItem.idl:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@200289 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index f8c00e8..b934073 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,47 @@
+2016-04-29 Chris Dumez <cdumez@apple.com>
+
+ [Web IDL] Specify default parameter values for callback parameters
+ https://bugs.webkit.org/show_bug.cgi?id=157188
+
+ Reviewed by Darin Adler.
+
+ Specify default parameter values for callback parameters.
+
+ * Modules/geolocation/Geolocation.idl:
+ * Modules/notifications/Notification.cpp:
+ (WebCore::Notification::requestPermission):
+ * Modules/notifications/Notification.h:
+ * Modules/notifications/Notification.idl:
+ * Modules/notifications/NotificationCenter.idl:
+ * Modules/quota/StorageInfo.cpp:
+ (WebCore::StorageInfo::queryUsageAndQuota):
+ (WebCore::StorageInfo::requestQuota):
+ * Modules/quota/StorageInfo.h:
+ * Modules/quota/StorageInfo.idl:
+ * Modules/quota/StorageQuota.h:
+ * Modules/quota/StorageQuota.idl:
+ * Modules/webaudio/AudioContext.idl:
+ * Modules/webdatabase/DOMWindowWebDatabase.cpp:
+ (WebCore::DOMWindowWebDatabase::openDatabase):
+ * Modules/webdatabase/DOMWindowWebDatabase.h:
+ (WebCore::DOMWindowWebDatabase::DOMWindowWebDatabase):
+ (WebCore::DOMWindowWebDatabase::~DOMWindowWebDatabase):
+ * Modules/webdatabase/DOMWindowWebDatabase.idl:
+ * Modules/webdatabase/Database.cpp:
+ (WebCore::Database::runTransaction):
+ (WebCore::Database::changeVersion):
+ (WebCore::Database::transaction):
+ (WebCore::Database::readTransaction):
+ * Modules/webdatabase/Database.h:
+ * Modules/webdatabase/Database.idl:
+ * Modules/webdatabase/SQLTransaction.idl:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateParametersCheck):
+ (CanUseWTFOptionalForParameter): Deleted.
+ * bindings/scripts/test/TestObj.idl:
+ * dom/DataTransferItem.h:
+ * dom/DataTransferItem.idl:
+
2016-04-28 Darin Adler <darin@apple.com>
First step in using "enum class" instead of "String" for enumerations in DOM
diff --git a/Source/WebCore/Modules/geolocation/Geolocation.idl b/Source/WebCore/Modules/geolocation/Geolocation.idl
index e3ac9ea..22e9c16 100644
--- a/Source/WebCore/Modules/geolocation/Geolocation.idl
+++ b/Source/WebCore/Modules/geolocation/Geolocation.idl
@@ -30,11 +30,11 @@
GenerateIsReachable=ImplFrame,
] interface Geolocation {
[Custom] void getCurrentPosition(PositionCallback successCallback,
- optional PositionErrorCallback errorCallback,
+ optional PositionErrorCallback? errorCallback,
optional PositionOptions options);
[Custom] long watchPosition(PositionCallback successCallback,
- optional PositionErrorCallback errorCallback,
+ optional PositionErrorCallback? errorCallback,
optional PositionOptions options);
void clearWatch(long watchID);
diff --git a/Source/WebCore/Modules/notifications/Notification.cpp b/Source/WebCore/Modules/notifications/Notification.cpp
index c29ae1f..a322d33 100644
--- a/Source/WebCore/Modules/notifications/Notification.cpp
+++ b/Source/WebCore/Modules/notifications/Notification.cpp
@@ -241,9 +241,9 @@
return String();
}
-void Notification::requestPermission(Document& document, PassRefPtr<NotificationPermissionCallback> callback)
+void Notification::requestPermission(Document& document, RefPtr<NotificationPermissionCallback>&& callback)
{
- NotificationController::from(document.page())->client()->requestPermission(&document, callback);
+ NotificationController::from(document.page())->client()->requestPermission(&document, WTFMove(callback));
}
#endif
diff --git a/Source/WebCore/Modules/notifications/Notification.h b/Source/WebCore/Modules/notifications/Notification.h
index 24e0c5c..795c937 100644
--- a/Source/WebCore/Modules/notifications/Notification.h
+++ b/Source/WebCore/Modules/notifications/Notification.h
@@ -124,7 +124,7 @@
#if ENABLE(NOTIFICATIONS)
static const String permission(Document&);
WEBCORE_EXPORT static const String permissionString(NotificationClient::Permission);
- static void requestPermission(Document&, PassRefPtr<NotificationPermissionCallback> = nullptr);
+ static void requestPermission(Document&, RefPtr<NotificationPermissionCallback>&&);
#endif
private:
diff --git a/Source/WebCore/Modules/notifications/Notification.idl b/Source/WebCore/Modules/notifications/Notification.idl
index 421793f..dbe4872 100644
--- a/Source/WebCore/Modules/notifications/Notification.idl
+++ b/Source/WebCore/Modules/notifications/Notification.idl
@@ -43,7 +43,7 @@
[Conditional=NOTIFICATIONS] void close();
[Conditional=NOTIFICATIONS, CallWith=Document] static readonly attribute DOMString permission;
- [Conditional=NOTIFICATIONS, CallWith=Document] static void requestPermission(optional NotificationPermissionCallback callback);
+ [Conditional=NOTIFICATIONS, CallWith=Document] static void requestPermission(optional NotificationPermissionCallback? callback);
attribute EventHandler onclick;
attribute EventHandler onclose;
diff --git a/Source/WebCore/Modules/notifications/NotificationCenter.idl b/Source/WebCore/Modules/notifications/NotificationCenter.idl
index 54343cf..39165fe 100644
--- a/Source/WebCore/Modules/notifications/NotificationCenter.idl
+++ b/Source/WebCore/Modules/notifications/NotificationCenter.idl
@@ -37,6 +37,6 @@
[RaisesException] Notification createNotification(DOMString iconUrl, DOMString title, DOMString body);
int checkPermission();
- void requestPermission(optional VoidCallback callback);
+ void requestPermission(optional VoidCallback? callback);
};
diff --git a/Source/WebCore/Modules/notifications/NotificationClient.h b/Source/WebCore/Modules/notifications/NotificationClient.h
index 731ded8..c7eb90b 100644
--- a/Source/WebCore/Modules/notifications/NotificationClient.h
+++ b/Source/WebCore/Modules/notifications/NotificationClient.h
@@ -75,10 +75,10 @@
// Requests user permission to show desktop notifications from a particular
// script context. The callback parameter should be run when the user has
// made a decision.
- virtual void requestPermission(ScriptExecutionContext*, PassRefPtr<VoidCallback>) = 0;
+ virtual void requestPermission(ScriptExecutionContext*, RefPtr<VoidCallback>&&) = 0;
#endif
#if ENABLE(NOTIFICATIONS)
- virtual void requestPermission(ScriptExecutionContext*, PassRefPtr<NotificationPermissionCallback>) = 0;
+ virtual void requestPermission(ScriptExecutionContext*, RefPtr<NotificationPermissionCallback>&&) = 0;
#endif
virtual bool hasPendingPermissionRequests(ScriptExecutionContext*) const = 0;
diff --git a/Source/WebCore/Modules/quota/StorageInfo.cpp b/Source/WebCore/Modules/quota/StorageInfo.cpp
index 590e40b..cd83a4a 100644
--- a/Source/WebCore/Modules/quota/StorageInfo.cpp
+++ b/Source/WebCore/Modules/quota/StorageInfo.cpp
@@ -52,28 +52,28 @@
{
}
-void StorageInfo::queryUsageAndQuota(ScriptExecutionContext& scriptExecutionContext, int storageType, PassRefPtr<StorageUsageCallback> successCallback, PassRefPtr<StorageErrorCallback> errorCallback)
+void StorageInfo::queryUsageAndQuota(ScriptExecutionContext& scriptExecutionContext, int storageType, RefPtr<StorageUsageCallback>&& successCallback, RefPtr<StorageErrorCallback>&& errorCallback)
{
// Dispatching the request to StorageQuota, as this interface is deprecated in favor of StorageQuota.
StorageQuota* storageQuota = getStorageQuota(storageType);
if (!storageQuota) {
// Unknown storage type is requested.
- scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NOT_SUPPORTED_ERR));
+ scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::create(WTFMove(errorCallback), NOT_SUPPORTED_ERR));
return;
}
- storageQuota->queryUsageAndQuota(scriptExecutionContext, successCallback, errorCallback);
+ storageQuota->queryUsageAndQuota(scriptExecutionContext, WTFMove(successCallback), WTFMove(errorCallback));
}
-void StorageInfo::requestQuota(ScriptExecutionContext& scriptExecutionContext, int storageType, unsigned long long newQuotaInBytes, PassRefPtr<StorageQuotaCallback> successCallback, PassRefPtr<StorageErrorCallback> errorCallback)
+void StorageInfo::requestQuota(ScriptExecutionContext& scriptExecutionContext, int storageType, unsigned long long newQuotaInBytes, RefPtr<StorageQuotaCallback>&& successCallback, RefPtr<StorageErrorCallback>&& errorCallback)
{
// Dispatching the request to StorageQuota, as this interface is deprecated in favor of StorageQuota.
StorageQuota* storageQuota = getStorageQuota(storageType);
if (!storageQuota) {
// Unknown storage type is requested.
- scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NOT_SUPPORTED_ERR));
+ scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::create(WTFMove(errorCallback), NOT_SUPPORTED_ERR));
return;
}
- storageQuota->requestQuota(scriptExecutionContext, newQuotaInBytes, successCallback, errorCallback);
+ storageQuota->requestQuota(scriptExecutionContext, newQuotaInBytes, WTFMove(successCallback), WTFMove(errorCallback));
}
StorageQuota* StorageInfo::getStorageQuota(int storageType)
diff --git a/Source/WebCore/Modules/quota/StorageInfo.h b/Source/WebCore/Modules/quota/StorageInfo.h
index 42da3f2..b684138 100644
--- a/Source/WebCore/Modules/quota/StorageInfo.h
+++ b/Source/WebCore/Modules/quota/StorageInfo.h
@@ -57,9 +57,9 @@
return adoptRef(*new StorageInfo());
}
- void queryUsageAndQuota(ScriptExecutionContext&, int storageType, PassRefPtr<StorageUsageCallback>, PassRefPtr<StorageErrorCallback>);
+ void queryUsageAndQuota(ScriptExecutionContext&, int storageType, RefPtr<StorageUsageCallback>&&, RefPtr<StorageErrorCallback>&&);
- void requestQuota(ScriptExecutionContext&, int storageType, unsigned long long newQuotaInBytes, PassRefPtr<StorageQuotaCallback>, PassRefPtr<StorageErrorCallback>);
+ void requestQuota(ScriptExecutionContext&, int storageType, unsigned long long newQuotaInBytes, RefPtr<StorageQuotaCallback>&&, RefPtr<StorageErrorCallback>&&);
~StorageInfo();
diff --git a/Source/WebCore/Modules/quota/StorageInfo.idl b/Source/WebCore/Modules/quota/StorageInfo.idl
index e6157a0..0626381 100644
--- a/Source/WebCore/Modules/quota/StorageInfo.idl
+++ b/Source/WebCore/Modules/quota/StorageInfo.idl
@@ -31,6 +31,6 @@
const unsigned short TEMPORARY = 0;
const unsigned short PERSISTENT = 1;
- [CallWith=ScriptExecutionContext] void queryUsageAndQuota(unsigned short storageType, optional StorageUsageCallback usageCallback, optional StorageErrorCallback errorCallback);
- [CallWith=ScriptExecutionContext] void requestQuota(unsigned short storageType, unsigned long long newQuotaInBytes, optional StorageQuotaCallback quotaCallback, optional StorageErrorCallback errorCallback);
+ [CallWith=ScriptExecutionContext] void queryUsageAndQuota(unsigned short storageType, optional StorageUsageCallback? usageCallback, optional StorageErrorCallback? errorCallback);
+ [CallWith=ScriptExecutionContext] void requestQuota(unsigned short storageType, unsigned long long newQuotaInBytes, optional StorageQuotaCallback? quotaCallback, optional StorageErrorCallback? errorCallback);
};
diff --git a/Source/WebCore/Modules/quota/StorageQuota.h b/Source/WebCore/Modules/quota/StorageQuota.h
index ccfde81..c7238d9 100644
--- a/Source/WebCore/Modules/quota/StorageQuota.h
+++ b/Source/WebCore/Modules/quota/StorageQuota.h
@@ -55,9 +55,9 @@
return adoptRef(*new StorageQuota(type));
}
- void queryUsageAndQuota(ScriptExecutionContext&, PassRefPtr<StorageUsageCallback>, PassRefPtr<StorageErrorCallback>);
+ void queryUsageAndQuota(ScriptExecutionContext&, RefPtr<StorageUsageCallback>&&, RefPtr<StorageErrorCallback>&&);
- void requestQuota(ScriptExecutionContext&, unsigned long long newQuotaInBytes, PassRefPtr<StorageQuotaCallback>, PassRefPtr<StorageErrorCallback>);
+ void requestQuota(ScriptExecutionContext&, unsigned long long newQuotaInBytes, RefPtr<StorageQuotaCallback>&&, RefPtr<StorageErrorCallback>&&);
~StorageQuota();
diff --git a/Source/WebCore/Modules/quota/StorageQuota.idl b/Source/WebCore/Modules/quota/StorageQuota.idl
index 937dc4e..e596aa3 100644
--- a/Source/WebCore/Modules/quota/StorageQuota.idl
+++ b/Source/WebCore/Modules/quota/StorageQuota.idl
@@ -28,6 +28,6 @@
Conditional=QUOTA,
ImplementationLacksVTable,
] interface StorageQuota {
- [CallWith=ScriptExecutionContext] void queryUsageAndQuota(StorageUsageCallback usageCallback, optional StorageErrorCallback errorCallback);
- [CallWith=ScriptExecutionContext] void requestQuota(unsigned long long newQuotaInBytes, optional StorageQuotaCallback quotaCallback, optional StorageErrorCallback errorCallback);
+ [CallWith=ScriptExecutionContext] void queryUsageAndQuota(StorageUsageCallback usageCallback, optional StorageErrorCallback? errorCallback);
+ [CallWith=ScriptExecutionContext] void requestQuota(unsigned long long newQuotaInBytes, optional StorageQuotaCallback? quotaCallback, optional StorageErrorCallback? errorCallback);
};
diff --git a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp
index 5b9fdb3..3e55902 100644
--- a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp
+++ b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp
@@ -37,16 +37,16 @@
namespace WebCore {
-RefPtr<Database> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec)
+RefPtr<Database> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, RefPtr<DatabaseCallback>&& creationCallback, ExceptionCode& ec)
{
if (!window.isCurrentlyDisplayedInFrame())
return nullptr;
- RefPtr<Database> database = nullptr;
+ RefPtr<Database> database;
DatabaseManager& dbManager = DatabaseManager::singleton();
DatabaseError error = DatabaseError::None;
if (dbManager.isAvailable() && window.document()->securityOrigin()->canAccessDatabase(window.document()->topOrigin())) {
- database = dbManager.openDatabase(window.document(), name, version, displayName, estimatedSize, creationCallback, error);
+ database = dbManager.openDatabase(window.document(), name, version, displayName, estimatedSize, WTFMove(creationCallback), error);
ASSERT(database || error != DatabaseError::None);
ec = DatabaseManager::exceptionCodeForDatabaseError(error);
} else
diff --git a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h
index 656f883..1ce239c 100644
--- a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h
+++ b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h
@@ -42,11 +42,10 @@
class DOMWindowWebDatabase {
public:
- static RefPtr<Database> openDatabase(DOMWindow&, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode&);
+ static RefPtr<Database> openDatabase(DOMWindow&, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, RefPtr<DatabaseCallback>&& creationCallback, ExceptionCode&);
-private:
- DOMWindowWebDatabase() { };
- ~DOMWindowWebDatabase() { };
+ DOMWindowWebDatabase() = delete;
+ ~DOMWindowWebDatabase() = delete;
};
} // namespace WebCore
diff --git a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl
index 15eb435..7a536d4 100644
--- a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl
+++ b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl
@@ -26,6 +26,6 @@
[
] partial interface DOMWindow {
- [RaisesException] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback);
+ [RaisesException] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback? creationCallback);
};
diff --git a/Source/WebCore/Modules/webdatabase/Database.cpp b/Source/WebCore/Modules/webdatabase/Database.cpp
index c08b861..813ca04 100644
--- a/Source/WebCore/Modules/webdatabase/Database.cpp
+++ b/Source/WebCore/Modules/webdatabase/Database.cpp
@@ -554,17 +554,17 @@
m_transactionInProgress = false;
}
-PassRefPtr<SQLTransactionBackend> Database::runTransaction(PassRefPtr<SQLTransaction> transaction, bool readOnly, const ChangeVersionData* data)
+RefPtr<SQLTransactionBackend> Database::runTransaction(Ref<SQLTransaction>&& transaction, bool readOnly, const ChangeVersionData* data)
{
LockHolder locker(m_transactionInProgressMutex);
if (!m_isTransactionQueueEnabled)
- return 0;
+ return nullptr;
RefPtr<SQLTransactionWrapper> wrapper;
if (data)
wrapper = ChangeVersionWrapper::create(data->oldVersion(), data->newVersion());
- RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, transaction, wrapper, readOnly);
+ RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, WTFMove(transaction), wrapper, readOnly);
m_transactionQueue.append(transactionBackend);
if (!m_transactionInProgress)
scheduleTransaction();
@@ -635,22 +635,20 @@
synchronizer.waitForTaskCompletion();
}
-void Database::changeVersion(const String& oldVersion, const String& newVersion,
- PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
- PassRefPtr<VoidCallback> successCallback)
+void Database::changeVersion(const String& oldVersion, const String& newVersion, RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback)
{
ChangeVersionData data(oldVersion, newVersion);
- runTransaction(callback, errorCallback, successCallback, false, &data);
+ runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), false, &data);
}
-void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
+void Database::transaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback)
{
- runTransaction(callback, errorCallback, successCallback, false);
+ runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), false);
}
-void Database::readTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
+void Database::readTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback)
{
- runTransaction(callback, errorCallback, successCallback, true);
+ runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), true);
}
String Database::stringIdentifier() const
@@ -732,11 +730,11 @@
void Database::runTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback, bool readOnly, const ChangeVersionData* changeVersionData)
{
- RefPtr<SQLTransaction> transaction = SQLTransaction::create(*this, WTFMove(callback), WTFMove(successCallback), errorCallback.copyRef(), readOnly);
+ Ref<SQLTransaction> transaction = SQLTransaction::create(*this, WTFMove(callback), WTFMove(successCallback), errorCallback.copyRef(), readOnly);
- RefPtr<SQLTransactionBackend> transactionBackend = runTransaction(transaction.release(), readOnly, changeVersionData);
+ RefPtr<SQLTransactionBackend> transactionBackend = runTransaction(WTFMove(transaction), readOnly, changeVersionData);
if (!transactionBackend && errorCallback) {
- WTF::RefPtr<SQLTransactionErrorCallback> errorCallbackProtector = WTFMove(errorCallback);
+ RefPtr<SQLTransactionErrorCallback> errorCallbackProtector = WTFMove(errorCallback);
m_scriptExecutionContext->postTask([errorCallbackProtector](ScriptExecutionContext&) {
errorCallbackProtector->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed").ptr());
});
diff --git a/Source/WebCore/Modules/webdatabase/Database.h b/Source/WebCore/Modules/webdatabase/Database.h
index 3d466ef..f3a4740 100644
--- a/Source/WebCore/Modules/webdatabase/Database.h
+++ b/Source/WebCore/Modules/webdatabase/Database.h
@@ -64,7 +64,7 @@
unsigned long long maximumSize() const;
- PassRefPtr<SQLTransactionBackend> runTransaction(PassRefPtr<SQLTransaction>, bool readOnly, const ChangeVersionData*);
+ RefPtr<SQLTransactionBackend> runTransaction(Ref<SQLTransaction>&&, bool readOnly, const ChangeVersionData*);
void scheduleTransactionStep(SQLTransactionBackend*);
void inProgressTransactionCompleted();
@@ -78,10 +78,9 @@
// Direct support for the DOM API
String version() const;
- void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>,
- PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
- void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
- void readTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
+ void changeVersion(const String& oldVersion, const String& newVersion, RefPtr<SQLTransactionCallback>&&, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<VoidCallback>&& successCallback);
+ void transaction(RefPtr<SQLTransactionCallback>&&, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<VoidCallback>&& successCallback);
+ void readTransaction(RefPtr<SQLTransactionCallback>&&, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<VoidCallback>&& successCallback);
// Internal engine support
String stringIdentifier() const;
diff --git a/Source/WebCore/Modules/webdatabase/Database.idl b/Source/WebCore/Modules/webdatabase/Database.idl
index ceb3f0b..8df804b 100644
--- a/Source/WebCore/Modules/webdatabase/Database.idl
+++ b/Source/WebCore/Modules/webdatabase/Database.idl
@@ -28,8 +28,8 @@
interface Database {
readonly attribute DOMString version;
- void changeVersion(DOMString oldVersion, DOMString newVersion, optional SQLTransactionCallback callback, optional SQLTransactionErrorCallback errorCallback, optional VoidCallback successCallback);
- void transaction(SQLTransactionCallback callback, optional SQLTransactionErrorCallback errorCallback, optional VoidCallback successCallback);
- void readTransaction(SQLTransactionCallback callback, optional SQLTransactionErrorCallback errorCallback, optional VoidCallback successCallback);
+ void changeVersion(DOMString oldVersion, DOMString newVersion, optional SQLTransactionCallback? callback, optional SQLTransactionErrorCallback? errorCallback, optional VoidCallback? successCallback);
+ void transaction(SQLTransactionCallback callback, optional SQLTransactionErrorCallback? errorCallback, optional VoidCallback? successCallback);
+ void readTransaction(SQLTransactionCallback callback, optional SQLTransactionErrorCallback? errorCallback, optional VoidCallback? successCallback);
};
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransaction.idl b/Source/WebCore/Modules/webdatabase/SQLTransaction.idl
index 516f696..2248c94 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransaction.idl
+++ b/Source/WebCore/Modules/webdatabase/SQLTransaction.idl
@@ -31,6 +31,6 @@
] interface SQLTransaction {
[Custom] void executeSql(DOMString sqlStatement,
ObjectArray arguments,
- optional SQLStatementCallback callback,
- optional SQLStatementErrorCallback errorCallback);
+ optional SQLStatementCallback? callback,
+ optional SQLStatementErrorCallback? errorCallback);
};
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
index d78d8e6..535f451 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -3444,7 +3444,6 @@
# FIXME: We should progressively stop blacklisting each type below
# and eventually get rid of this function entirely.
return 0 if $parameter->isVariadic;
- return 0 if $codeGenerator->IsCallbackInterface($type);
return 0 if $codeGenerator->IsEnumType($type);
return 1;
@@ -3536,7 +3535,7 @@
my $argType = $parameter->type;
my $optional = $parameter->isOptional;
- die "Optional parameters of non-nullable wrapper types are not supported" if $optional && !$parameter->isNullable && $codeGenerator->IsWrapperType($argType) && !$codeGenerator->IsCallbackInterface($argType);
+ die "Optional parameters of non-nullable wrapper types are not supported" if $optional && !$parameter->isNullable && $codeGenerator->IsWrapperType($argType);
if ($optional && !defined($parameter->default)) {
# As per Web IDL, optional dictionary parameters are always considered to have a default value of an empty dictionary, unless otherwise specified.
@@ -3551,10 +3550,13 @@
# As per Web IDL, passing undefined for a nullable parameter is treated as null. Therefore, use null as
# default value for nullable parameters unless otherwise specified.
$parameter->default("null") if $parameter->isNullable;
+
+ # For callback parameters, the generated bindings treat undefined as null, so use null as implicit default value.
+ $parameter->default("null") if $codeGenerator->IsCallbackInterface($argType);
}
# FIXME: We should eventually stop generating any early calls, and instead use either default parameter values or WTF::Optional<>.
- if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameter($parameter) && !$codeGenerator->IsCallbackInterface($argType)) {
+ if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameter($parameter)) {
# Generate early call if there are enough parameters.
if (!$hasOptionalArguments) {
push(@$outputArray, "\n size_t argsCount = state->argumentCount();\n");
diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl
index cdc0d14..5889f3e 100644
--- a/Source/WebCore/bindings/scripts/test/TestObj.idl
+++ b/Source/WebCore/bindings/scripts/test/TestObj.idl
@@ -208,15 +208,15 @@
// Callback interface parameters.
void methodWithCallbackArg(TestCallback callback);
void methodWithNonCallbackArgAndCallbackArg(long nonCallback, TestCallback callback);
- void methodWithCallbackAndOptionalArg(optional TestCallback callback);
+ void methodWithCallbackAndOptionalArg(optional TestCallback? callback);
// Callback function parameters.
void methodWithCallbackFunctionArg(TestCallbackFunction callback);
void methodWithNonCallbackArgAndCallbackFunctionArg(long nonCallback, TestCallbackFunction callback);
- void methodWithCallbackFunctionAndOptionalArg(optional TestCallbackFunction callback);
+ void methodWithCallbackFunctionAndOptionalArg(optional TestCallbackFunction? callback);
// static methods with 'Callback' extended attribute
- static void staticMethodWithCallbackAndOptionalArg(optional TestCallback callback);
+ static void staticMethodWithCallbackAndOptionalArg(optional TestCallback? callback);
static void staticMethodWithCallbackArg(TestCallback callback);
#endif
diff --git a/Source/WebCore/dom/DataTransferItem.h b/Source/WebCore/dom/DataTransferItem.h
index 11f58e9..4648c2a 100644
--- a/Source/WebCore/dom/DataTransferItem.h
+++ b/Source/WebCore/dom/DataTransferItem.h
@@ -53,7 +53,7 @@
virtual String kind() const = 0;
virtual String type() const = 0;
- virtual void getAsString(PassRefPtr<StringCallback>) const = 0;
+ virtual void getAsString(RefPtr<StringCallback>&&) const = 0;
virtual PassRefPtr<Blob> getAsFile() const = 0;
};
diff --git a/Source/WebCore/dom/DataTransferItem.idl b/Source/WebCore/dom/DataTransferItem.idl
index 8df9759..fb722b8 100644
--- a/Source/WebCore/dom/DataTransferItem.idl
+++ b/Source/WebCore/dom/DataTransferItem.idl
@@ -36,7 +36,7 @@
readonly attribute DOMString kind;
readonly attribute DOMString type;
- void getAsString(optional StringCallback callback);
+ void getAsString(optional StringCallback? callback);
Blob getAsFile();
};
diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
index 3d5a45a..d87aa14 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
@@ -60,10 +60,10 @@
void notificationObjectDestroyed(WebCore::Notification*) override;
void notificationControllerDestroyed() override;
#if ENABLE(LEGACY_NOTIFICATIONS)
- void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) override;
+ void requestPermission(WebCore::ScriptExecutionContext*, RefPtr<WebCore::VoidCallback>&&) override;
#endif
#if ENABLE(NOTIFICATIONS)
- void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::NotificationPermissionCallback>) override;
+ void requestPermission(WebCore::ScriptExecutionContext*, RefPtr<WebCore::NotificationPermissionCallback>&&) override;
#endif
void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) override { }
bool hasPendingPermissionRequests(WebCore::ScriptExecutionContext*) const override;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
index ade93d0..f55298c 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
@@ -182,7 +182,7 @@
#endif
#if ENABLE(LEGACY_NOTIFICATIONS)
-void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback)
+void WebNotificationClient::requestPermission(ScriptExecutionContext* context, RefPtr<VoidCallback>&& callback)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
WebNotificationPolicyListener *listener = [[WebNotificationPolicyListener alloc] initWithVoidCallback:callback];
@@ -204,7 +204,7 @@
}
#if ENABLE(NOTIFICATIONS)
-void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback)
+void WebNotificationClient::requestPermission(ScriptExecutionContext* context, RefPtr<NotificationPermissionCallback>&& callback)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
WebNotificationPolicyListener *listener = [[WebNotificationPolicyListener alloc] initWithCallback:callback];
diff --git a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
index 02c3c58..14a7059 100644
--- a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
@@ -170,14 +170,14 @@
{
}
-void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback>)
+void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin, RefPtr<VoidCallback>&&)
{
BString org(origin->toString());
if (hasNotificationDelegate())
notificationDelegate()->requestNotificationPermission(org);
}
-void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin*, PassRefPtr<NotificationPermissionCallback>)
+void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin*, RefPtr<NotificationPermissionCallback>&&)
{
}
diff --git a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
index b9e4478..2878a98 100644
--- a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
+++ b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
@@ -51,10 +51,10 @@
virtual void notificationObjectDestroyed(WebCore::Notification* object);
virtual void notificationControllerDestroyed();
#if ENABLE(LEGACY_NOTIFICATIONS)
- virtual void requestPermission(WebCore::SecurityOrigin*, PassRefPtr<WebCore::VoidCallback>);
+ virtual void requestPermission(WebCore::SecurityOrigin*, RefPtr<WebCore::VoidCallback>&&);
#endif
#if ENABLE(NOTIFICATIONS)
- virtual void requestPermission(WebCore::SecurityOrigin*, PassRefPtr<WebCore::NotificationPermissionCallback>);
+ virtual void requestPermission(WebCore::SecurityOrigin*, RefPtr<WebCore::NotificationPermissionCallback>&&);
#endif
bool hasPendingPermissionRequests(WebCore::ScriptExecutionContext*) const override;
virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*);
diff --git a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
index 15a5bba..81ff1b1 100644
--- a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
+++ b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
@@ -69,7 +69,7 @@
#endif
#if ENABLE(NOTIFICATIONS)
-void NotificationPermissionRequestManager::startRequest(SecurityOrigin* origin, PassRefPtr<NotificationPermissionCallback> callback)
+void NotificationPermissionRequestManager::startRequest(SecurityOrigin* origin, RefPtr<NotificationPermissionCallback>&& callback)
{
NotificationClient::Permission permission = permissionLevel(origin);
if (permission != NotificationClient::PermissionNotAllowed) {
@@ -81,13 +81,13 @@
uint64_t requestID = generateRequestID();
m_originToIDMap.set(origin, requestID);
m_idToOriginMap.set(requestID, origin);
- m_idToCallbackMap.set(requestID, callback);
+ m_idToCallbackMap.set(requestID, WTFMove(callback));
m_page->send(Messages::WebPageProxy::RequestNotificationPermission(requestID, origin->toString()));
}
#endif
#if ENABLE(LEGACY_NOTIFICATIONS)
-void NotificationPermissionRequestManager::startRequest(SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback)
+void NotificationPermissionRequestManager::startRequest(SecurityOrigin* origin, RefPtr<WebCore::VoidCallback>&& callback)
{
NotificationClient::Permission permission = permissionLevel(origin);
if (permission != NotificationClient::PermissionNotAllowed) {
@@ -99,7 +99,7 @@
uint64_t requestID = generateRequestID();
m_originToIDMap.set(origin, requestID);
m_idToOriginMap.set(requestID, origin);
- m_idToVoidCallbackMap.set(requestID, callback);
+ m_idToVoidCallbackMap.set(requestID, WTFMove(callback));
m_page->send(Messages::WebPageProxy::RequestNotificationPermission(requestID, origin->toString()));
}
#endif
diff --git a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h
index 70827d6..86e4cfc 100644
--- a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h
+++ b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h
@@ -50,10 +50,10 @@
static Ref<NotificationPermissionRequestManager> create(WebPage*);
#if ENABLE(NOTIFICATIONS)
- void startRequest(WebCore::SecurityOrigin*, PassRefPtr<WebCore::NotificationPermissionCallback>);
+ void startRequest(WebCore::SecurityOrigin*, RefPtr<WebCore::NotificationPermissionCallback>&&);
#endif
#if ENABLE(LEGACY_NOTIFICATIONS)
- void startRequest(WebCore::SecurityOrigin*, PassRefPtr<WebCore::VoidCallback>);
+ void startRequest(WebCore::SecurityOrigin*, RefPtr<WebCore::VoidCallback>&&);
#endif
void cancelRequest(WebCore::SecurityOrigin*);
bool hasPendingPermissionRequests(WebCore::SecurityOrigin*) const;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp
index c7d821a..23a1401 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp
@@ -73,16 +73,16 @@
}
#if ENABLE(LEGACY_NOTIFICATIONS)
-void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<WebCore::VoidCallback> callback)
+void WebNotificationClient::requestPermission(ScriptExecutionContext* context, RefPtr<WebCore::VoidCallback>&& callback)
{
- m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), callback);
+ m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), WTFMove(callback));
}
#endif
#if ENABLE(NOTIFICATIONS)
-void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback)
+void WebNotificationClient::requestPermission(ScriptExecutionContext* context, RefPtr<NotificationPermissionCallback>&& callback)
{
- m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), callback);
+ m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), WTFMove(callback));
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h
index 1df255e..9bc80d1 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h
@@ -52,10 +52,10 @@
void notificationObjectDestroyed(WebCore::Notification*) override;
void notificationControllerDestroyed() override;
#if ENABLE(LEGACY_NOTIFICATIONS)
- void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) override;
+ void requestPermission(WebCore::ScriptExecutionContext*, RefPtr<WebCore::VoidCallback>&&) override;
#endif
#if ENABLE(NOTIFICATIONS)
- void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::NotificationPermissionCallback>) override;
+ void requestPermission(WebCore::ScriptExecutionContext*, RefPtr<WebCore::NotificationPermissionCallback>&&) override;
#endif
void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) override;
bool hasPendingPermissionRequests(WebCore::ScriptExecutionContext*) const override;