Title: [283595] trunk/Source/WebKit
Revision
283595
Author
[email protected]
Date
2021-10-05 18:16:27 -0700 (Tue, 05 Oct 2021)

Log Message

Do daily activity in AdAttributionDaemon based off of when the xpc activity happens
https://bugs.webkit.org/show_bug.cgi?id=231254

Patch by Alex Christensen <[email protected]> on 2021-10-05
Reviewed by Kate Cheney.

Before this change, we did the activity 5 seconds after startup of the daemon, which can be started
by sending an attribution to it or by the daily xpc activity.  We want to do it only because of the xpc activity.

* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::doDailyActivityInManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::registerScheduledActivityHandler):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (283594 => 283595)


--- trunk/Source/WebKit/ChangeLog	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/ChangeLog	2021-10-06 01:16:27 UTC (rev 283595)
@@ -1,3 +1,25 @@
+2021-10-05  Alex Christensen  <[email protected]>
+
+        Do daily activity in AdAttributionDaemon based off of when the xpc activity happens
+        https://bugs.webkit.org/show_bug.cgi?id=231254
+
+        Reviewed by Kate Cheney.
+
+        Before this change, we did the activity 5 seconds after startup of the daemon, which can be started
+        by sending an attribution to it or by the daily xpc activity.  We want to do it only because of the xpc activity.
+
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h:
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h:
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h:
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
+        (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
+        (WebKit::PCM::doDailyActivityInManager):
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
+        * Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
+        (WebKit::registerScheduledActivityHandler):
+
 2021-10-05  Aditya Keerthi  <[email protected]>
 
         [iOS] Transcode videos selected from UIImagePickerController

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h (283594 => 283595)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h	2021-10-06 01:16:27 UTC (rev 283595)
@@ -49,6 +49,7 @@
     virtual void broadcastConsoleMessage(JSC::MessageLevel, const String&) = 0;
     virtual bool featureEnabled() const = 0;
     virtual bool debugModeEnabled() const = 0;
+    virtual bool runningInDaemon() const = 0;
 };
 
 } // namespace PCM

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h (283594 => 283595)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h	2021-10-06 01:16:27 UTC (rev 283595)
@@ -46,6 +46,7 @@
     void broadcastConsoleMessage(JSC::MessageLevel, const String&) final;
     bool featureEnabled() const final;
     bool debugModeEnabled() const final;
+    bool runningInDaemon() const final { return false; }
 
     WeakPtr<NetworkSession> m_networkSession;
     Ref<NetworkProcess> m_networkProcess;

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h (283594 => 283595)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h	2021-10-06 01:16:27 UTC (rev 283595)
@@ -38,6 +38,7 @@
     void broadcastConsoleMessage(JSC::MessageLevel, const String&) final;
     bool featureEnabled() const final;
     bool debugModeEnabled() const final;
+    bool runningInDaemon() const final { return true; }
 };
 
 } // namespace PCM

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp (283594 => 283595)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp	2021-10-06 01:16:27 UTC (rev 283595)
@@ -60,8 +60,9 @@
 {
     // We should send any pending attributions on session-start in case their
     // send delay has expired while the session was closed. Waiting 5 seconds accounts for the
-    // delay in database startup.
-    startTimer(5_s);
+    // delay in database startup. When running in the daemon, the xpc activity does this instead.
+    if (!m_client->runningInDaemon())
+        startTimer(5_s);
 }
 
 PrivateClickMeasurementManager::~PrivateClickMeasurementManager()

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h (283594 => 283595)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h	2021-10-06 01:16:27 UTC (rev 283595)
@@ -53,6 +53,7 @@
     void clearForRegistrableDomain(const RegistrableDomain&, CompletionHandler<void()>&&) final;
     void migratePrivateClickMeasurementFromLegacyStorage(PrivateClickMeasurement&&, PrivateClickMeasurementAttributionType) final;
     void setDebugModeIsEnabled(bool) final;
+    void firePendingAttributionRequests();
 
     void toStringForTesting(CompletionHandler<void(String)>&&) const final;
     void setOverrideTimerForTesting(bool value) final { m_isRunningTest = value; }
@@ -78,7 +79,6 @@
     void attribute(const SourceSite&, const AttributionDestinationSite&, AttributionTriggerData&&, const ApplicationBundleIdentifier&);
     void fireConversionRequest(const PrivateClickMeasurement&, PrivateClickMeasurement::AttributionReportEndpoint);
     void fireConversionRequestImpl(const PrivateClickMeasurement&, PrivateClickMeasurement::AttributionReportEndpoint);
-    void firePendingAttributionRequests();
     void clearExpired();
     bool featureEnabled() const;
     bool debugModeEnabled() const;

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp (283594 => 283595)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp	2021-10-06 01:16:27 UTC (rev 283595)
@@ -246,6 +246,11 @@
     IPC::callMemberFunction(WTFMove(*arguments), WTFMove(completionHandler), &daemonManager(), Info::MemberFunction);
 }
 
+void doDailyActivityInManager()
+{
+    daemonManager().firePendingAttributionRequests();
+}
+
 void decodeMessageAndSendToManager(const Connection& connection, MessageType messageType, Vector<uint8_t>&& encodedMessage, CompletionHandler<void(Vector<uint8_t>&&)>&& replySender)
 {
     ASSERT(messageTypeSendsReply(messageType) == !!replySender);

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h (283594 => 283595)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h	2021-10-06 01:16:27 UTC (rev 283595)
@@ -107,6 +107,7 @@
 using EncodedMessage = Vector<uint8_t>;
 
 void decodeMessageAndSendToManager(const Connection&, MessageType, Vector<uint8_t>&& message, CompletionHandler<void(Vector<uint8_t>&&)>&&);
+void doDailyActivityInManager();
 bool messageTypeSendsReply(MessageType);
 
 void initializePCMStorageInDirectory(const String&);

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm (283594 => 283595)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm	2021-10-06 00:56:43 UTC (rev 283594)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm	2021-10-06 01:16:27 UTC (rev 283595)
@@ -119,7 +119,7 @@
             return;
         }
 
-        // FIXME: Add code here that does daily tasks of PrivateClickMeasurementManager.
+        PCM::doDailyActivityInManager();
     });
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to