Commit f3666b4c authored by Chris Hamilton's avatar Chris Hamilton Committed by Commit Bot

Create FrameToken, WorkerToken, etc.

This defines a handful of MultiToken<> variants (and their mojom traits)
that will be used in renderer code, as well as in renderer to browser IPC.

BUG=1085129, 1096617

Change-Id: I548ecfe2824d2a8e78c0af8a197abebf2ab6fc41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2337104
Commit-Queue: Chris Hamilton <chrisha@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795182}
parent c306d932
...@@ -147,6 +147,7 @@ jumbo_source_set("common") { ...@@ -147,6 +147,7 @@ jumbo_source_set("common") {
"service_worker/service_worker_utils.cc", "service_worker/service_worker_utils.cc",
"switches.cc", "switches.cc",
"thread_safe_browser_interface_broker_proxy.cc", "thread_safe_browser_interface_broker_proxy.cc",
"tokens/tokens_mojom_traits.cc",
"user_agent/user_agent_metadata.cc", "user_agent/user_agent_metadata.cc",
"web_package/signed_exchange_consts.cc", "web_package/signed_exchange_consts.cc",
"web_package/web_package_request_matcher.cc", "web_package/web_package_request_matcher.cc",
...@@ -244,6 +245,7 @@ jumbo_source_set("common_unittests_sources") { ...@@ -244,6 +245,7 @@ jumbo_source_set("common_unittests_sources") {
"origin_trials/trial_token_validator_unittest.cc", "origin_trials/trial_token_validator_unittest.cc",
"test/run_all_unittests.cc", "test/run_all_unittests.cc",
"tokens/multi_token_unittest.cc", "tokens/multi_token_unittest.cc",
"tokens/tokens_mojom_traits_unittest.cc",
"user_agent/user_agent_metadata_unittest.cc", "user_agent/user_agent_metadata_unittest.cc",
"web_package/web_package_request_matcher_unittest.cc", "web_package/web_package_request_matcher_unittest.cc",
] ]
......
per-file *_mojom_traits*.*=set noparent
per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/common/tokens/tokens_mojom_traits.h"
#include "mojo/public/cpp/base/unguessable_token_mojom_traits.h"
namespace mojo {
////////////////////////////////////////////////////////////////////////////////
// FRAME TOKENS
/////////////
// FrameToken
// static
bool UnionTraits<blink::mojom::FrameTokenDataView, blink::FrameToken>::Read(
blink::mojom::FrameTokenDataView input,
blink::FrameToken* output) {
using Tag = blink::mojom::FrameTokenDataView::Tag;
switch (input.tag()) {
case Tag::LOCAL_FRAME_TOKEN: {
blink::LocalFrameToken token;
bool ret = input.ReadLocalFrameToken(&token);
*output = token;
return ret;
}
case Tag::REMOTE_FRAME_TOKEN: {
blink::RemoteFrameToken token;
bool ret = input.ReadRemoteFrameToken(&token);
*output = token;
return ret;
}
}
}
// static
blink::mojom::FrameTokenDataView::Tag
UnionTraits<blink::mojom::FrameTokenDataView, blink::FrameToken>::GetTag(
const blink::FrameToken& token) {
using Tag = blink::mojom::FrameTokenDataView::Tag;
if (token.Is<blink::LocalFrameToken>())
return Tag::LOCAL_FRAME_TOKEN;
DCHECK(token.Is<blink::RemoteFrameToken>());
return Tag::REMOTE_FRAME_TOKEN;
}
// static
blink::LocalFrameToken UnionTraits<
blink::mojom::FrameTokenDataView,
blink::FrameToken>::local_frame_token(const blink::FrameToken& token) {
return token.GetAs<blink::LocalFrameToken>();
}
// static
blink::RemoteFrameToken UnionTraits<
blink::mojom::FrameTokenDataView,
blink::FrameToken>::remote_frame_token(const blink::FrameToken& token) {
return token.GetAs<blink::RemoteFrameToken>();
}
////////////////////////////////////////////////////////////////////////////////
// WORKER TOKENS
//////////////
// WorkerToken
// static
bool UnionTraits<blink::mojom::WorkerTokenDataView, blink::WorkerToken>::Read(
blink::mojom::WorkerTokenDataView input,
blink::WorkerToken* output) {
using Tag = blink::mojom::WorkerTokenDataView::Tag;
switch (input.tag()) {
case Tag::DEDICATED_WORKER_TOKEN: {
blink::DedicatedWorkerToken token;
bool ret = input.ReadDedicatedWorkerToken(&token);
*output = token;
return ret;
}
case Tag::SERVICE_WORKER_TOKEN: {
blink::ServiceWorkerToken token;
bool ret = input.ReadServiceWorkerToken(&token);
*output = token;
return ret;
}
case Tag::SHARED_WORKER_TOKEN: {
blink::SharedWorkerToken token;
bool ret = input.ReadSharedWorkerToken(&token);
*output = token;
return ret;
}
}
return false;
}
// static
blink::mojom::WorkerTokenDataView::Tag
UnionTraits<blink::mojom::WorkerTokenDataView, blink::WorkerToken>::GetTag(
const blink::WorkerToken& token) {
using Tag = blink::mojom::WorkerTokenDataView::Tag;
if (token.Is<blink::DedicatedWorkerToken>())
return Tag::DEDICATED_WORKER_TOKEN;
if (token.Is<blink::ServiceWorkerToken>())
return Tag::SERVICE_WORKER_TOKEN;
DCHECK(token.Is<blink::SharedWorkerToken>());
return Tag::SHARED_WORKER_TOKEN;
}
// static
blink::DedicatedWorkerToken
UnionTraits<blink::mojom::WorkerTokenDataView, blink::WorkerToken>::
dedicated_worker_token(const blink::WorkerToken& token) {
return token.GetAs<blink::DedicatedWorkerToken>();
}
// static
blink::ServiceWorkerToken UnionTraits<
blink::mojom::WorkerTokenDataView,
blink::WorkerToken>::service_worker_token(const blink::WorkerToken& token) {
return token.GetAs<blink::ServiceWorkerToken>();
}
// static
blink::SharedWorkerToken UnionTraits<
blink::mojom::WorkerTokenDataView,
blink::WorkerToken>::shared_worker_token(const blink::WorkerToken& token) {
return token.GetAs<blink::SharedWorkerToken>();
}
////////////////////////////////////////////////////////////////////////////////
// OTHER TOKENS
//
// Keep this section last.
//
// If you have multiple tokens that make a thematic group, please lift them to
// their own section, in alphabetical order. If adding a new token here, please
// keep the following list in alphabetic order.
///////////////////////////////////
// ExecutionContextAttributionToken
// static
bool UnionTraits<blink::mojom::ExecutionContextAttributionTokenDataView,
blink::ExecutionContextAttributionToken>::
Read(blink::mojom::ExecutionContextAttributionTokenDataView input,
blink::ExecutionContextAttributionToken* output) {
using Tag = blink::mojom::ExecutionContextAttributionTokenDataView::Tag;
switch (input.tag()) {
case Tag::LOCAL_FRAME_TOKEN: {
blink::LocalFrameToken token;
bool ret = input.ReadLocalFrameToken(&token);
*output = token;
return ret;
}
case Tag::DEDICATED_WORKER_TOKEN: {
blink::DedicatedWorkerToken token;
bool ret = input.ReadDedicatedWorkerToken(&token);
*output = token;
return ret;
}
case Tag::SERVICE_WORKER_TOKEN: {
blink::ServiceWorkerToken token;
bool ret = input.ReadServiceWorkerToken(&token);
*output = token;
return ret;
}
case Tag::SHARED_WORKER_TOKEN: {
blink::SharedWorkerToken token;
bool ret = input.ReadSharedWorkerToken(&token);
*output = token;
return ret;
}
}
return false;
}
// static
blink::mojom::ExecutionContextAttributionTokenDataView::Tag
UnionTraits<blink::mojom::ExecutionContextAttributionTokenDataView,
blink::ExecutionContextAttributionToken>::
GetTag(const blink::ExecutionContextAttributionToken& token) {
using Tag = blink::mojom::ExecutionContextAttributionTokenDataView::Tag;
if (token.Is<blink::LocalFrameToken>())
return Tag::LOCAL_FRAME_TOKEN;
if (token.Is<blink::DedicatedWorkerToken>())
return Tag::DEDICATED_WORKER_TOKEN;
if (token.Is<blink::ServiceWorkerToken>())
return Tag::SERVICE_WORKER_TOKEN;
DCHECK(token.Is<blink::SharedWorkerToken>());
return Tag::SHARED_WORKER_TOKEN;
}
// static
blink::LocalFrameToken
UnionTraits<blink::mojom::ExecutionContextAttributionTokenDataView,
blink::ExecutionContextAttributionToken>::
local_frame_token(const blink::ExecutionContextAttributionToken& token) {
return token.GetAs<blink::LocalFrameToken>();
}
// static
blink::DedicatedWorkerToken
UnionTraits<blink::mojom::ExecutionContextAttributionTokenDataView,
blink::ExecutionContextAttributionToken>::
dedicated_worker_token(
const blink::ExecutionContextAttributionToken& token) {
return token.GetAs<blink::DedicatedWorkerToken>();
}
// static
blink::ServiceWorkerToken
UnionTraits<blink::mojom::ExecutionContextAttributionTokenDataView,
blink::ExecutionContextAttributionToken>::
service_worker_token(const blink::ExecutionContextAttributionToken& token) {
return token.GetAs<blink::ServiceWorkerToken>();
}
// static
blink::SharedWorkerToken
UnionTraits<blink::mojom::ExecutionContextAttributionTokenDataView,
blink::ExecutionContextAttributionToken>::
shared_worker_token(const blink::ExecutionContextAttributionToken& token) {
return token.GetAs<blink::SharedWorkerToken>();
}
} // namespace mojo
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/common/tokens/tokens_mojom_traits.h"
#include "base/unguessable_token.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/tokens/tokens.mojom.h"
namespace mojo {
namespace {
// Tests round-trip serialization for the given TokenType of a given
// MultiTokenType.
template <typename MultiTokenType, typename MojomType, typename TokenType>
void ExpectSerializationWorks() {
base::UnguessableToken raw_token = base::UnguessableToken::Create();
TokenType typed_token(raw_token);
MultiTokenType multi_token(typed_token);
MultiTokenType deserialized;
EXPECT_TRUE(::mojo::test::SerializeAndDeserialize<MojomType>(&multi_token,
&deserialized));
EXPECT_TRUE(deserialized.template Is<TokenType>());
EXPECT_EQ(multi_token, deserialized);
EXPECT_EQ(multi_token.template GetAs<TokenType>(),
deserialized.template GetAs<TokenType>());
EXPECT_EQ(raw_token, deserialized.value());
}
} // namespace
TEST(FrameTokenTest, MojomTraits) {
ExpectSerializationWorks<blink::FrameToken, blink::mojom::FrameToken,
blink::LocalFrameToken>();
ExpectSerializationWorks<blink::FrameToken, blink::mojom::FrameToken,
blink::RemoteFrameToken>();
}
TEST(WorkerTokenTest, MojomTraits) {
ExpectSerializationWorks<blink::WorkerToken, blink::mojom::WorkerToken,
blink::DedicatedWorkerToken>();
ExpectSerializationWorks<blink::WorkerToken, blink::mojom::WorkerToken,
blink::ServiceWorkerToken>();
ExpectSerializationWorks<blink::WorkerToken, blink::mojom::WorkerToken,
blink::SharedWorkerToken>();
}
TEST(ExecutionContextAttributionTokenTest, MojomTraits) {
ExpectSerializationWorks<blink::ExecutionContextAttributionToken,
blink::mojom::ExecutionContextAttributionToken,
blink::LocalFrameToken>();
ExpectSerializationWorks<blink::ExecutionContextAttributionToken,
blink::mojom::ExecutionContextAttributionToken,
blink::DedicatedWorkerToken>();
ExpectSerializationWorks<blink::ExecutionContextAttributionToken,
blink::mojom::ExecutionContextAttributionToken,
blink::ServiceWorkerToken>();
ExpectSerializationWorks<blink::ExecutionContextAttributionToken,
blink::mojom::ExecutionContextAttributionToken,
blink::SharedWorkerToken>();
}
} // namespace mojo
per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=set noparent
per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
per-file *.typemap=set noparent
per-file *.typemap=file://ipc/SECURITY_OWNERS
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_H_
#include "base/util/type_safety/token_type.h" #include "base/util/type_safety/token_type.h"
#include "third_party/blink/public/common/tokens/multi_token.h"
namespace blink { namespace blink {
...@@ -34,6 +35,9 @@ using LocalFrameToken = util::TokenType<class LocalFrameTokenTypeMarker>; ...@@ -34,6 +35,9 @@ using LocalFrameToken = util::TokenType<class LocalFrameTokenTypeMarker>;
// will be distinct. // will be distinct.
using RemoteFrameToken = util::TokenType<class RemoteFrameTokenTypeMarker>; using RemoteFrameToken = util::TokenType<class RemoteFrameTokenTypeMarker>;
// Can represent either type of FrameToken.
using FrameToken = MultiToken<LocalFrameToken, RemoteFrameToken>;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// WORKER TOKENS // WORKER TOKENS
...@@ -42,13 +46,17 @@ using RemoteFrameToken = util::TokenType<class RemoteFrameTokenTypeMarker>; ...@@ -42,13 +46,17 @@ using RemoteFrameToken = util::TokenType<class RemoteFrameTokenTypeMarker>;
using DedicatedWorkerToken = using DedicatedWorkerToken =
util::TokenType<class DedicatedWorkerTokenTypeMarker>; util::TokenType<class DedicatedWorkerTokenTypeMarker>;
// Identifies a blink::ServiceWorkerGlobalScope in the renderer and a
// content::ServiceWorkerVersion in the browser.
using ServiceWorkerToken = util::TokenType<class ServiceWorkerTokenTypeMarker>;
// Identifies a blink::SharedWorkerGlobalScope in the renderer and a // Identifies a blink::SharedWorkerGlobalScope in the renderer and a
// content::SharedWorkerHost in the browser. // content::SharedWorkerHost in the browser.
using SharedWorkerToken = util::TokenType<class SharedWorkerTokenTypeMarker>; using SharedWorkerToken = util::TokenType<class SharedWorkerTokenTypeMarker>;
// Identifies a blink::ServiceWorkerGlobalScope in the renderer and a // Can represent any type of WorkerToken.
// content::ServiceWorkerVersion in the browser. using WorkerToken =
using ServiceWorkerToken = util::TokenType<class ServiceWorkerTokenTypeMarker>; MultiToken<DedicatedWorkerToken, ServiceWorkerToken, SharedWorkerToken>;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// OTHER TOKENS // OTHER TOKENS
...@@ -59,6 +67,16 @@ using ServiceWorkerToken = util::TokenType<class ServiceWorkerTokenTypeMarker>; ...@@ -59,6 +67,16 @@ using ServiceWorkerToken = util::TokenType<class ServiceWorkerTokenTypeMarker>;
// their own section, in alphabetical order. If adding a new token here, please // their own section, in alphabetical order. If adding a new token here, please
// keep the following list in alphabetic order. // keep the following list in alphabetic order.
// Identifies an ExecutionContext hosted in a renderer for the purposes of
// memory and CPU attribution. Worklets are not tracked independently, but
// simply attributed to their parent context, hence only LocalFrames and workers
// can be named. As such, it is possible for multiple ExecutionContexts to have
// the same ExecutionContextAttributionToken.
using ExecutionContextAttributionToken = MultiToken<LocalFrameToken,
DedicatedWorkerToken,
ServiceWorkerToken,
SharedWorkerToken>;
// Identifies a blink::PortalContents / blink::HTMLPortalElement in the // Identifies a blink::PortalContents / blink::HTMLPortalElement in the
// renderer process, and a content::Portal in the browser process. // renderer process, and a content::Portal in the browser process.
using PortalToken = util::TokenType<class PortalTokenTypeMarker>; using PortalToken = util::TokenType<class PortalTokenTypeMarker>;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_MOJOM_TRAITS_H_ #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_MOJOM_TRAITS_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_MOJOM_TRAITS_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_MOJOM_TRAITS_H_
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/common/tokens/token_mojom_traits_helper.h" #include "third_party/blink/public/common/tokens/token_mojom_traits_helper.h"
#include "third_party/blink/public/common/tokens/tokens.h" #include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/tokens/tokens.mojom-shared.h" #include "third_party/blink/public/mojom/tokens/tokens.mojom-shared.h"
...@@ -31,6 +32,19 @@ struct StructTraits<blink::mojom::RemoteFrameTokenDataView, ...@@ -31,6 +32,19 @@ struct StructTraits<blink::mojom::RemoteFrameTokenDataView,
blink::mojom::RemoteFrameTokenDataView, blink::mojom::RemoteFrameTokenDataView,
blink::RemoteFrameToken> {}; blink::RemoteFrameToken> {};
template <>
struct BLINK_COMMON_EXPORT
UnionTraits<blink::mojom::FrameTokenDataView, blink::FrameToken> {
static bool Read(blink::mojom::FrameTokenDataView input,
blink::FrameToken* output);
static blink::mojom::FrameTokenDataView::Tag GetTag(
const blink::FrameToken& token);
static blink::LocalFrameToken local_frame_token(
const blink::FrameToken& token);
static blink::RemoteFrameToken remote_frame_token(
const blink::FrameToken& token);
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// WORKER TOKENS // WORKER TOKENS
...@@ -55,6 +69,21 @@ struct StructTraits<blink::mojom::SharedWorkerTokenDataView, ...@@ -55,6 +69,21 @@ struct StructTraits<blink::mojom::SharedWorkerTokenDataView,
blink::mojom::SharedWorkerTokenDataView, blink::mojom::SharedWorkerTokenDataView,
blink::SharedWorkerToken> {}; blink::SharedWorkerToken> {};
template <>
struct BLINK_COMMON_EXPORT
UnionTraits<blink::mojom::WorkerTokenDataView, blink::WorkerToken> {
static bool Read(blink::mojom::WorkerTokenDataView input,
blink::WorkerToken* output);
static blink::mojom::WorkerTokenDataView::Tag GetTag(
const blink::WorkerToken& token);
static blink::DedicatedWorkerToken dedicated_worker_token(
const blink::WorkerToken& token);
static blink::ServiceWorkerToken service_worker_token(
const blink::WorkerToken& token);
static blink::SharedWorkerToken shared_worker_token(
const blink::WorkerToken& token);
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// OTHER TOKENS // OTHER TOKENS
// //
...@@ -64,6 +93,24 @@ struct StructTraits<blink::mojom::SharedWorkerTokenDataView, ...@@ -64,6 +93,24 @@ struct StructTraits<blink::mojom::SharedWorkerTokenDataView,
// their own section, in alphabetical order. If adding a new token here, please // their own section, in alphabetical order. If adding a new token here, please
// keep the following list in alphabetic order. // keep the following list in alphabetic order.
template <>
struct BLINK_COMMON_EXPORT
UnionTraits<blink::mojom::ExecutionContextAttributionTokenDataView,
blink::ExecutionContextAttributionToken> {
static bool Read(blink::mojom::ExecutionContextAttributionTokenDataView input,
blink::ExecutionContextAttributionToken* output);
static blink::mojom::ExecutionContextAttributionTokenDataView::Tag GetTag(
const blink::ExecutionContextAttributionToken& token);
static blink::LocalFrameToken local_frame_token(
const blink::ExecutionContextAttributionToken& token);
static blink::DedicatedWorkerToken dedicated_worker_token(
const blink::ExecutionContextAttributionToken& token);
static blink::ServiceWorkerToken service_worker_token(
const blink::ExecutionContextAttributionToken& token);
static blink::SharedWorkerToken shared_worker_token(
const blink::ExecutionContextAttributionToken& token);
};
template <> template <>
struct StructTraits<blink::mojom::PortalTokenDataView, blink::PortalToken> struct StructTraits<blink::mojom::PortalTokenDataView, blink::PortalToken>
: public blink::TokenMojomTraitsHelper<blink::mojom::PortalTokenDataView, : public blink::TokenMojomTraitsHelper<blink::mojom::PortalTokenDataView,
......
...@@ -23,6 +23,10 @@ mojom_component("tokens") { ...@@ -23,6 +23,10 @@ mojom_component("tokens") {
mojom = "blink.mojom.RemoteFrameToken" mojom = "blink.mojom.RemoteFrameToken"
cpp = "::blink::RemoteFrameToken" cpp = "::blink::RemoteFrameToken"
}, },
{
mojom = "blink.mojom.FrameToken"
cpp = "::blink::FrameToken"
},
# WORKER TOKENS # WORKER TOKENS
{ {
...@@ -37,6 +41,10 @@ mojom_component("tokens") { ...@@ -37,6 +41,10 @@ mojom_component("tokens") {
mojom = "blink.mojom.SharedWorkerToken" mojom = "blink.mojom.SharedWorkerToken"
cpp = "::blink::SharedWorkerToken" cpp = "::blink::SharedWorkerToken"
}, },
{
mojom = "blink.mojom.WorkerToken"
cpp = "::blink::WorkerToken"
},
# OTHER TOKENS # OTHER TOKENS
# #
...@@ -45,6 +53,10 @@ mojom_component("tokens") { ...@@ -45,6 +53,10 @@ mojom_component("tokens") {
# If you have multiple tokens that make a thematic group, please lift # If you have multiple tokens that make a thematic group, please lift
# them to their own section, in alphabetical order. If adding a new # them to their own section, in alphabetical order. If adding a new
# token here, please keep the following list in alphabetic order. # token here, please keep the following list in alphabetic order.
{
mojom = "blink.mojom.ExecutionContextAttributionToken"
cpp = "::blink::ExecutionContextAttributionToken"
},
{ {
mojom = "blink.mojom.PortalToken" mojom = "blink.mojom.PortalToken"
cpp = "::blink::PortalToken" cpp = "::blink::PortalToken"
......
...@@ -27,6 +27,11 @@ struct RemoteFrameToken { ...@@ -27,6 +27,11 @@ struct RemoteFrameToken {
mojo_base.mojom.UnguessableToken value; mojo_base.mojom.UnguessableToken value;
}; };
union FrameToken {
LocalFrameToken local_frame_token;
RemoteFrameToken remote_frame_token;
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// WORKER TOKENS // WORKER TOKENS
...@@ -34,14 +39,20 @@ struct DedicatedWorkerToken { ...@@ -34,14 +39,20 @@ struct DedicatedWorkerToken {
mojo_base.mojom.UnguessableToken value; mojo_base.mojom.UnguessableToken value;
}; };
struct SharedWorkerToken { struct ServiceWorkerToken {
mojo_base.mojom.UnguessableToken value; mojo_base.mojom.UnguessableToken value;
}; };
struct ServiceWorkerToken { struct SharedWorkerToken {
mojo_base.mojom.UnguessableToken value; mojo_base.mojom.UnguessableToken value;
}; };
union WorkerToken {
DedicatedWorkerToken dedicated_worker_token;
ServiceWorkerToken service_worker_token;
SharedWorkerToken shared_worker_token;
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// OTHER TOKENS // OTHER TOKENS
// //
...@@ -51,6 +62,13 @@ struct ServiceWorkerToken { ...@@ -51,6 +62,13 @@ struct ServiceWorkerToken {
// their own section, in alphabetical order. If adding a new token here, please // their own section, in alphabetical order. If adding a new token here, please
// keep the following list in alphabetic order. // keep the following list in alphabetic order.
union ExecutionContextAttributionToken {
LocalFrameToken local_frame_token;
DedicatedWorkerToken dedicated_worker_token;
ServiceWorkerToken service_worker_token;
SharedWorkerToken shared_worker_token;
};
struct PortalToken { struct PortalToken {
mojo_base.mojom.UnguessableToken value; mojo_base.mojom.UnguessableToken value;
}; };
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