Commit 3c6ec75b authored by Caleb Raitto's avatar Caleb Raitto Committed by Commit Bot

Allow the Dactyloscoper to handle optional values.

Bug: 973801
Change-Id: Ibe6dcee62b3fcbae9ad6dddcb200cf1df81bd077
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350360Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Caleb Raitto <caraitto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799352}
parent c8bdb034
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DACTYLOSCOPER_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DACTYLOSCOPER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DACTYLOSCOPER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DACTYLOSCOPER_H_
#include "base/optional.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_token.h" #include "third_party/blink/public/common/privacy_budget/identifiable_token.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h"
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/svg/svg_string_list_tear_off.h" #include "third_party/blink/renderer/core/svg/svg_string_list_tear_off.h"
...@@ -45,6 +47,18 @@ class CORE_EXPORT Dactyloscoper { ...@@ -45,6 +47,18 @@ class CORE_EXPORT Dactyloscoper {
WebFeature, WebFeature,
SVGStringListTearOff*); SVGStringListTearOff*);
template <typename T>
static void RecordDirectSurface(ExecutionContext* context,
WebFeature feature,
const base::Optional<T>& value) {
if (value.has_value()) {
RecordDirectSurface(context, feature, value.value());
} else {
RecordDirectSurface(context, feature,
IdentifiableTokenBuilder().GetToken());
}
}
private: private:
DISALLOW_COPY_AND_ASSIGN(Dactyloscoper); DISALLOW_COPY_AND_ASSIGN(Dactyloscoper);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment