RESOLVED FIXED 228984
PCM: Support ephemeral measurement with non-persistent WebCore::PrivateClickMeasurement
https://bugs.webkit.org/show_bug.cgi?id=228984
Summary PCM: Support ephemeral measurement with non-persistent WebCore::PrivateClickM...
John Wilander
Reported 2021-08-10 23:01:45 PDT
We should support ephemeral measurement with non-persistent WebCore::PrivateClickMeasurement for direct response advertising.
Attachments
Patch (21.77 KB, patch)
2021-08-10 23:17 PDT, John Wilander
no flags
Patch (47.58 KB, patch)
2021-08-12 16:27 PDT, John Wilander
no flags
Patch for landing (48.19 KB, patch)
2021-08-23 16:45 PDT, John Wilander
no flags
Radar WebKit Bug Importer
Comment 1 2021-08-10 23:02:05 PDT
John Wilander
Comment 2 2021-08-10 23:17:19 PDT
youenn fablet
Comment 3 2021-08-12 04:52:04 PDT
Comment on attachment 435325 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=435325&action=review > Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:1521 > +void WebResourceLoadStatisticsStore::attributePrivateClickMeasurement(const PrivateClickMeasurement::SourceSite& sourceSite, const PrivateClickMeasurement::AttributionDestinationSite& destinationSite, PrivateClickMeasurement::AttributionTriggerData&& attributionTriggerData, std::optional<PrivateClickMeasurement> ephemeralMeasurement, CompletionHandler<void(std::optional<WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData>)>&& completionHandler) Should probably be optional<>&& since that could otherwise trigger ref/unref > Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:1530 > + postTask([this, sourceSite, destinationSite, attributionTriggerData = WTFMove(attributionTriggerData), ephemeralMeasurement, completionHandler = WTFMove(completionHandler)]() mutable { postTask probably means going to a background thread. In that case we should isolate copy ephemeralMeasurement which has some strings.
John Wilander
Comment 4 2021-08-12 10:05:50 PDT
(In reply to youenn fablet from comment #3) > Comment on attachment 435325 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=435325&action=review > > > Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:1521 > > +void WebResourceLoadStatisticsStore::attributePrivateClickMeasurement(const PrivateClickMeasurement::SourceSite& sourceSite, const PrivateClickMeasurement::AttributionDestinationSite& destinationSite, PrivateClickMeasurement::AttributionTriggerData&& attributionTriggerData, std::optional<PrivateClickMeasurement> ephemeralMeasurement, CompletionHandler<void(std::optional<WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData>)>&& completionHandler) > > Should probably be optional<>&& since that could otherwise trigger ref/unref > > > Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:1530 > > + postTask([this, sourceSite, destinationSite, attributionTriggerData = WTFMove(attributionTriggerData), ephemeralMeasurement, completionHandler = WTFMove(completionHandler)]() mutable { > > postTask probably means going to a background thread. > In that case we should isolate copy ephemeralMeasurement which has some > strings. Thanks, Youenn! Will fix in the patch that also has the test.
John Wilander
Comment 5 2021-08-12 16:27:19 PDT
Kate Cheney
Comment 6 2021-08-18 13:27:35 PDT
Comment on attachment 435456 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=435456&action=review Needs to be rebased to fix some data races but otherwise LGTM. > Source/WebCore/loader/PrivateClickMeasurement.h:50 > +enum class PrivateClickMeasurementAttributionPersistent : bool { Yes, No }; I think we usually use { No, Yes }. > Source/WebCore/loader/PrivateClickMeasurement.h:392 > + PrivateClickMeasurementAttributionPersistent m_isPersistent; You may need to set the default value to be ::Yes, I think enums default to 0 which will be ::No if you change the ordering above. > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:248 > + m_ephemeralMeasurement = measurement; m_ephemeralMeasurement = WTFMove(measurement) I think.
John Wilander
Comment 7 2021-08-23 14:05:51 PDT
(In reply to Kate Cheney from comment #6) > Comment on attachment 435456 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=435456&action=review > > Needs to be rebased to fix some data races but otherwise LGTM. I saw that. Will fix. > > Source/WebCore/loader/PrivateClickMeasurement.h:50 > > +enum class PrivateClickMeasurementAttributionPersistent : bool { Yes, No }; > > I think we usually use { No, Yes }. Will fix. > > Source/WebCore/loader/PrivateClickMeasurement.h:392 > > + PrivateClickMeasurementAttributionPersistent m_isPersistent; > > You may need to set the default value to be ::Yes, I think enums default to > 0 which will be ::No if you change the ordering above. > > > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:248 > > + m_ephemeralMeasurement = measurement; > > m_ephemeralMeasurement = WTFMove(measurement) I think. Good catch. Will fix. Thanks for the review, Kate!
Chris Dumez
Comment 8 2021-08-23 14:09:30 PDT
Comment on attachment 435456 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=435456&action=review > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:300 > + resourceLoadStatistics->attributePrivateClickMeasurement(sourceSite, destinationSite, WTFMove(attributionTriggerData), WTFMove(m_ephemeralMeasurement), [this, weakThis = makeWeakPtr(*this)] (auto attributionSecondsUntilSendData) { Please use std::exchange() instead of WTFMove() for m_ephemeralMeasurement for avoid use-after-move bugs.
John Wilander
Comment 9 2021-08-23 16:45:57 PDT
Created attachment 436248 [details] Patch for landing
John Wilander
Comment 10 2021-08-23 16:49:33 PDT
(In reply to Chris Dumez from comment #8) > Comment on attachment 435456 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=435456&action=review > > > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:300 > > + resourceLoadStatistics->attributePrivateClickMeasurement(sourceSite, destinationSite, WTFMove(attributionTriggerData), WTFMove(m_ephemeralMeasurement), [this, weakThis = makeWeakPtr(*this)] (auto attributionSecondsUntilSendData) { > > Please use std::exchange() instead of WTFMove() for m_ephemeralMeasurement > for avoid use-after-move bugs. I made this change. Thanks, Chris!
EWS
Comment 11 2021-08-23 17:33:40 PDT
Committed r281480 (240858@main): <https://commits.webkit.org/240858@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 436248 [details].
Note You need to log in before you can comment on or make changes to this bug.