Title: [225335] trunk/Source/WebCore
- Revision
- 225335
- Author
- cdu...@apple.com
- Date
- 2017-11-30 11:17:55 -0800 (Thu, 30 Nov 2017)
Log Message
Rename RegistrationOptions to ServiceWorkerRegistrationOptions
https://bugs.webkit.org/show_bug.cgi?id=180207
Reviewed by Geoffrey Garen.
Rename RegistrationOptions to ServiceWorkerRegistrationOptions as the name
RegistrationOptions is too generic and likely to conflict. Also modernize
ServiceWorkerRegistrationOptions' IPC decoder.
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJobData.h:
(WebCore::ServiceWorkerJobData::decode):
* workers/service/ServiceWorkerRegistrationOptions.cpp:
(WebCore::ServiceWorkerRegistrationOptions::isolatedCopy const):
* workers/service/ServiceWorkerRegistrationOptions.h:
(WebCore::ServiceWorkerRegistrationOptions::encode const):
(WebCore::ServiceWorkerRegistrationOptions::decode):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (225334 => 225335)
--- trunk/Source/WebCore/ChangeLog 2017-11-30 19:14:04 UTC (rev 225334)
+++ trunk/Source/WebCore/ChangeLog 2017-11-30 19:17:55 UTC (rev 225335)
@@ -1,3 +1,23 @@
+2017-11-30 Chris Dumez <cdu...@apple.com>
+
+ Rename RegistrationOptions to ServiceWorkerRegistrationOptions
+ https://bugs.webkit.org/show_bug.cgi?id=180207
+
+ Reviewed by Geoffrey Garen.
+
+ Rename RegistrationOptions to ServiceWorkerRegistrationOptions as the name
+ RegistrationOptions is too generic and likely to conflict. Also modernize
+ ServiceWorkerRegistrationOptions' IPC decoder.
+
+ * workers/service/ServiceWorkerContainer.h:
+ * workers/service/ServiceWorkerJobData.h:
+ (WebCore::ServiceWorkerJobData::decode):
+ * workers/service/ServiceWorkerRegistrationOptions.cpp:
+ (WebCore::ServiceWorkerRegistrationOptions::isolatedCopy const):
+ * workers/service/ServiceWorkerRegistrationOptions.h:
+ (WebCore::ServiceWorkerRegistrationOptions::encode const):
+ (WebCore::ServiceWorkerRegistrationOptions::decode):
+
2017-11-30 Darin Adler <da...@apple.com>
[Mac] remove unneeded RetainPtr use introduced in r225142
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h (225334 => 225335)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2017-11-30 19:14:04 UTC (rev 225334)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2017-11-30 19:17:55 UTC (rev 225335)
@@ -53,13 +53,12 @@
ServiceWorkerContainer(ScriptExecutionContext&, NavigatorBase&);
~ServiceWorkerContainer();
- typedef WebCore::RegistrationOptions RegistrationOptions;
-
ServiceWorker* controller() const;
using ReadyPromise = DOMPromiseProxy<IDLInterface<ServiceWorkerRegistration>>;
ReadyPromise& ready() { return m_readyPromise; }
+ using RegistrationOptions = ServiceWorkerRegistrationOptions;
void addRegistration(const String& scriptURL, const RegistrationOptions&, Ref<DeferredPromise>&&);
void removeRegistration(const URL& scopeURL, Ref<DeferredPromise>&&);
void updateRegistration(const URL& scopeURL, const URL& scriptURL, WorkerType, Ref<DeferredPromise>&&);
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h (225334 => 225335)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h 2017-11-30 19:14:04 UTC (rev 225334)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h 2017-11-30 19:17:55 UTC (rev 225335)
@@ -51,7 +51,7 @@
URL scopeURL;
ServiceWorkerJobType type;
- RegistrationOptions registrationOptions;
+ ServiceWorkerRegistrationOptions registrationOptions;
Identifier identifier() const { return m_identifier; }
ServiceWorkerRegistrationKey registrationKey() const;
@@ -89,11 +89,11 @@
if (!identifier)
return std::nullopt;
- std::optional<ServiceWorkerJobData> jobData = { ServiceWorkerJobData { WTFMove(*identifier) } };
+ ServiceWorkerJobData jobData { WTFMove(*identifier) };
- if (!decoder.decode(jobData->scriptURL))
+ if (!decoder.decode(jobData.scriptURL))
return std::nullopt;
- if (!decoder.decode(jobData->clientCreationURL))
+ if (!decoder.decode(jobData.clientCreationURL))
return std::nullopt;
std::optional<SecurityOriginData> topOrigin;
@@ -100,24 +100,28 @@
decoder >> topOrigin;
if (!topOrigin)
return std::nullopt;
- jobData->topOrigin = WTFMove(*topOrigin);
+ jobData.topOrigin = WTFMove(*topOrigin);
- if (!decoder.decode(jobData->scopeURL))
+ if (!decoder.decode(jobData.scopeURL))
return std::nullopt;
- if (!decoder.decodeEnum(jobData->type))
+ if (!decoder.decodeEnum(jobData.type))
return std::nullopt;
- switch (jobData->type) {
- case ServiceWorkerJobType::Register:
- if (!decoder.decode(jobData->registrationOptions))
+ switch (jobData.type) {
+ case ServiceWorkerJobType::Register: {
+ std::optional<ServiceWorkerRegistrationOptions> registrationOptions;
+ decoder >> registrationOptions;
+ if (!registrationOptions)
return std::nullopt;
+ jobData.registrationOptions = WTFMove(*registrationOptions);
break;
+ }
case ServiceWorkerJobType::Unregister:
case ServiceWorkerJobType::Update:
break;
}
- return jobData;
+ return WTFMove(jobData);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.cpp (225334 => 225335)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.cpp 2017-11-30 19:14:04 UTC (rev 225334)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.cpp 2017-11-30 19:17:55 UTC (rev 225335)
@@ -30,14 +30,9 @@
namespace WebCore {
-RegistrationOptions RegistrationOptions::isolatedCopy() const
+ServiceWorkerRegistrationOptions ServiceWorkerRegistrationOptions::isolatedCopy() const
{
- RegistrationOptions result;
- result.scope = scope.isolatedCopy();
- result.type = type;
- result.updateViaCache = updateViaCache;
-
- return result;
+ return ServiceWorkerRegistrationOptions { scope.isolatedCopy(), type, updateViaCache };
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h (225334 => 225335)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h 2017-11-30 19:14:04 UTC (rev 225334)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h 2017-11-30 19:17:55 UTC (rev 225335)
@@ -34,36 +34,42 @@
enum class ServiceWorkerUpdateViaCache;
enum class WorkerType;
-struct RegistrationOptions {
+struct ServiceWorkerRegistrationOptions {
String scope;
WorkerType type;
ServiceWorkerUpdateViaCache updateViaCache;
- RegistrationOptions isolatedCopy() const;
+ ServiceWorkerRegistrationOptions isolatedCopy() const;
template<class Encoder> void encode(Encoder&) const;
- template<class Decoder> static bool decode(Decoder&, RegistrationOptions&);
+ template<class Decoder> static std::optional<ServiceWorkerRegistrationOptions> decode(Decoder&);
};
template<class Encoder>
-void RegistrationOptions::encode(Encoder& encoder) const
+void ServiceWorkerRegistrationOptions::encode(Encoder& encoder) const
{
- encoder << scope;
- encoder.encodeEnum(type);
- encoder.encodeEnum(updateViaCache);
+ encoder << scope << type << updateViaCache;
}
template<class Decoder>
-bool RegistrationOptions::decode(Decoder& decoder, RegistrationOptions& options)
+std::optional<ServiceWorkerRegistrationOptions> ServiceWorkerRegistrationOptions::decode(Decoder& decoder)
{
- if (!decoder.decode(options.scope))
- return false;
- if (!decoder.decodeEnum(options.type))
- return false;
- if (!decoder.decodeEnum(options.updateViaCache))
- return false;
+ std::optional<String> scope;
+ decoder >> scope;
+ if (!scope)
+ return std::nullopt;
- return true;
+ std::optional<WorkerType> type;
+ decoder >> type;
+ if (!type)
+ return std::nullopt;
+
+ std::optional<ServiceWorkerUpdateViaCache> updateViaCache;
+ decoder >> updateViaCache;
+ if (!updateViaCache)
+ return std::nullopt;
+
+ return ServiceWorkerRegistrationOptions { WTFMove(*scope), WTFMove(*type), WTFMove(*updateViaCache) };
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes