Title: [288974] trunk/Source/WebCore
Revision
288974
Author
[email protected]
Date
2022-02-02 11:51:20 -0800 (Wed, 02 Feb 2022)

Log Message

Support sending WorkerOptions over IPC
https://bugs.webkit.org/show_bug.cgi?id=236026

Reviewed by Sam Weinig.

Support sending WorkerOptions over IPC, as this is will needed by Shared Workers.

* workers/WorkerGlobalScopeProxy.h:
* workers/WorkerOptions.h:
(WebCore::WorkerOptions::encode const):
(WebCore::WorkerOptions::decode):
* workers/WorkerType.h:
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerRegistrationOptions.h:
* workers/service/server/SWServerWorker.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288973 => 288974)


--- trunk/Source/WebCore/ChangeLog	2022-02-02 19:30:04 UTC (rev 288973)
+++ trunk/Source/WebCore/ChangeLog	2022-02-02 19:51:20 UTC (rev 288974)
@@ -1,5 +1,23 @@
 2022-02-02  Chris Dumez  <[email protected]>
 
+        Support sending WorkerOptions over IPC
+        https://bugs.webkit.org/show_bug.cgi?id=236026
+
+        Reviewed by Sam Weinig.
+
+        Support sending WorkerOptions over IPC, as this is will needed by Shared Workers.
+
+        * workers/WorkerGlobalScopeProxy.h:
+        * workers/WorkerOptions.h:
+        (WebCore::WorkerOptions::encode const):
+        (WebCore::WorkerOptions::decode):
+        * workers/WorkerType.h:
+        * workers/service/ServiceWorkerContainer.h:
+        * workers/service/ServiceWorkerRegistrationOptions.h:
+        * workers/service/server/SWServerWorker.h:
+
+2022-02-02  Chris Dumez  <[email protected]>
+
         Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider
         https://bugs.webkit.org/show_bug.cgi?id=236016
 

Modified: trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h (288973 => 288974)


--- trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h	2022-02-02 19:30:04 UTC (rev 288973)
+++ trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h	2022-02-02 19:51:20 UTC (rev 288974)
@@ -44,7 +44,7 @@
 class ScriptExecutionContext;
 class Worker;
 enum class ReferrerPolicy : uint8_t;
-enum class WorkerType : uint8_t;
+enum class WorkerType : bool;
 
 // A proxy to talk to the worker context.
 class WorkerGlobalScopeProxy {

Modified: trunk/Source/WebCore/workers/WorkerOptions.h (288973 => 288974)


--- trunk/Source/WebCore/workers/WorkerOptions.h	2022-02-02 19:30:04 UTC (rev 288973)
+++ trunk/Source/WebCore/workers/WorkerOptions.h	2022-02-02 19:51:20 UTC (rev 288974)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,6 +34,36 @@
     WorkerType type { WorkerType::Classic };
     FetchRequestCredentials credentials { FetchRequestCredentials::SameOrigin };
     String name;
+
+    template<class Encoder> void encode(Encoder&) const;
+    template<class Decoder> static std::optional<WorkerOptions> decode(Decoder&);
 };
 
+template<class Encoder>
+void WorkerOptions::encode(Encoder& encoder) const
+{
+    encoder << type << credentials << name;
+}
+
+template<class Decoder>
+std::optional<WorkerOptions> WorkerOptions::decode(Decoder& decoder)
+{
+    std::optional<WorkerType> workerType;
+    decoder >> workerType;
+    if (!workerType)
+        return std::nullopt;
+
+    std::optional<FetchRequestCredentials> credentials;
+    decoder >> credentials;
+    if (!credentials)
+        return std::nullopt;
+
+    std::optional<String> name;
+    decoder >> name;
+    if (!name)
+        return std::nullopt;
+
+    return { { *workerType, *credentials, WTFMove(*name) } };
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/WorkerType.h (288973 => 288974)


--- trunk/Source/WebCore/workers/WorkerType.h	2022-02-02 19:30:04 UTC (rev 288973)
+++ trunk/Source/WebCore/workers/WorkerType.h	2022-02-02 19:51:20 UTC (rev 288974)
@@ -27,9 +27,6 @@
 
 namespace WebCore {
 
-enum class WorkerType : uint8_t {
-    Classic,
-    Module,
-};
+enum class WorkerType : bool { Classic, Module };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h (288973 => 288974)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h	2022-02-02 19:30:04 UTC (rev 288973)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h	2022-02-02 19:51:20 UTC (rev 288974)
@@ -50,7 +50,7 @@
 class ServiceWorker;
 
 enum class ServiceWorkerUpdateViaCache : uint8_t;
-enum class WorkerType : uint8_t;
+enum class WorkerType : bool;
 
 template<typename IDLType> class DOMPromiseProxy;
 

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h (288973 => 288974)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h	2022-02-02 19:30:04 UTC (rev 288973)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h	2022-02-02 19:51:20 UTC (rev 288974)
@@ -32,7 +32,7 @@
 namespace WebCore {
 
 enum class ServiceWorkerUpdateViaCache : uint8_t;
-enum class WorkerType : uint8_t;
+enum class WorkerType : bool;
 
 struct ServiceWorkerRegistrationOptions {
     String scope;

Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.h (288973 => 288974)


--- trunk/Source/WebCore/workers/service/server/SWServerWorker.h	2022-02-02 19:30:04 UTC (rev 288973)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.h	2022-02-02 19:51:20 UTC (rev 288974)
@@ -53,7 +53,7 @@
 struct ServiceWorkerContextData;
 struct ServiceWorkerJobDataIdentifier;
 enum class WorkerThreadMode : bool;
-enum class WorkerType : uint8_t;
+enum class WorkerType : bool;
 
 class SWServerWorker : public RefCounted<SWServerWorker> {
 public:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to