[Sheriff] Revert "Implement auction blob creation for server-side FLEDGE"
This reverts commit 24d459e20f
.
Reason for revert: Reverting as two of the added tests are failing:
* AdAuctionServiceImplTest.SerializesAuctionBlob
* AdAuctionServiceImplTest.SerializesMultipleOwnersAuctionBlob
across the following builders:
* Step "bf_cache_content_unittests on Ubuntu-22.04" failing on builder "chromium/ci/linux-bfcache-rel"
* Step "content_unittests on Mac-10.13.6" failing on builder "chromium/ci/Mac10.13 Tests"
* Step "content_unittests on Mac-10.14.6" failing on builder "chromium/ci/Mac10.14 Tests"
* Step "content_unittests on Mac-11" failing on builder "chromium/ci/mac11-arm64-rel-tests"
* Step "content_unittests on Ubuntu-20.04" failing on builder "chromium/ci/fuchsia-arm64-rel"
* Step "content_unittests on Ubuntu-22.04" failing on builder "chromium/ci/Cast Audio Linux"
* Step "content_unittests on Ubuntu-22.04" failing on builder "chromium/ci/Cast Linux"
* Step "content_unittests on Ubuntu-22.04" failing on builder "chromium/ci/Linux Tests (Wayland)"
* Step "content_unittests on Ubuntu-22.04" failing on builder "chromium/ci/linux-lacros-tester-rel"
Original change's description:
> Implement auction blob creation for server-side FLEDGE
>
> Bug: 1442274
> Change-Id: I8be9575a4fb69a793f95edbf393f6919b82de100
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4533337
> Reviewed-by: Caleb Raitto <caraitto@chromium.org>
> Commit-Queue: Russ Hamilton <behamilton@google.com>
> Cr-Commit-Position: refs/heads/main@{#1152120}
Bug: 1442274
Change-Id: I867b8b209f1fbe4b5b44cfe23819a110ee103aca
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4582093
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1152258}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c41a68c1d0
commit
c84c38fa3e
content/browser/interest_group
third_party/blink/public/common/interest_group
@ -9,7 +9,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/barrier_closure.h"
|
||||
#include "base/base64.h"
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/feature_list.h"
|
||||
@ -58,7 +57,6 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/common/interest_group/interest_group.h"
|
||||
#include "third_party/blink/public/common/interest_group/test_interest_group_builder.h"
|
||||
#include "third_party/blink/public/common/permissions_policy/permissions_policy_features.h"
|
||||
#include "third_party/blink/public/mojom/interest_group/ad_auction_service.mojom.h"
|
||||
#include "third_party/blink/public/mojom/interest_group/interest_group_types.mojom.h"
|
||||
@ -7521,191 +7519,4 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
auction_worklet::mojom::KAnonymityBidMode::kSimulate,
|
||||
auction_worklet::mojom::KAnonymityBidMode::kEnforce));
|
||||
|
||||
TEST_F(AdAuctionServiceImplTest, SerializesAuctionBlob) {
|
||||
url::Origin test_origin = url::Origin::Create(GURL(kOriginStringA));
|
||||
manager_->JoinInterestGroup(
|
||||
blink::TestInterestGroupBuilder(test_origin, "cars")
|
||||
.SetTrustedBiddingSignalsKeys({{"key1", "key2"}})
|
||||
.SetUserBiddingSignals("{}")
|
||||
.SetAds(
|
||||
{{{GURL("https://c.test/ad.html"), /*metadata=*/"do not send",
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "1234"},
|
||||
{GURL("https://c.test/ad2.html"), /*metadata=*/absl::nullopt},
|
||||
{GURL("https://c.test/ad3.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "456"}}})
|
||||
.SetAdComponents(
|
||||
{{{GURL("https://c.test/ad4.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "789"}}})
|
||||
.Build(),
|
||||
GURL("https://a.test/example.html"));
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
manager_->RecordInterestGroupWin(
|
||||
{test_origin, "cars"},
|
||||
R"({"renderUrl": "https://c.test/ad.html", "adRenderId": "1234"})");
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
manager_->RecordInterestGroupWin(
|
||||
{test_origin, "cars"}, R"({"renderUrl": "https://c.test/ad2.html"})");
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
manager_->RecordInterestGroupWin({test_origin, "cars"},
|
||||
R"({"renderUrl": "corrupt JSON)");
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
|
||||
std::vector<uint8_t> msg;
|
||||
base::RunLoop run_loop;
|
||||
manager_->GetInterestGroupAdAuctionData(
|
||||
/*seller=*/test_origin, /*top_level_origin=*/test_origin,
|
||||
base::BindLambdaForTesting([&](std::vector<uint8_t> inner_msg) {
|
||||
msg = inner_msg;
|
||||
run_loop.Quit();
|
||||
}));
|
||||
run_loop.Run();
|
||||
std::string expected =
|
||||
"o2d2ZXJzaW9uAGlwdWJsaXNoZXJuaHR0cHM6Ly9hLnRlc3RuaW50ZXJlc3RHcm91cHOhbmh0"
|
||||
"dHBzOi8vYS50ZXN0WJcfiwgAAAAAAAAAVY07DsIwEAX5XSgh/"
|
||||
"FpSUlLQYntXzkKyjtYJyEIU8VkQ58RENDSvmdG84W0U+"
|
||||
"AhZvixMsVoDqwbBKPG1gtI1rWPkzg9ms92xFnf3KEeyrGr/"
|
||||
"soIG2YRFpSm5PXeTqhW8nYh9jLNznI9ZujjiEU8liUBsf4UDhnR9xZB9J5c+xfd/"
|
||||
"hn48P6XlwYuiAAAA";
|
||||
EXPECT_EQ(expected, base::Base64Encode(msg));
|
||||
}
|
||||
|
||||
TEST_F(AdAuctionServiceImplTest, SerializesAuctionBlobWithNoGroups) {
|
||||
url::Origin test_origin = url::Origin::Create(GURL(kOriginStringA));
|
||||
std::vector<uint8_t> msg;
|
||||
base::RunLoop run_loop;
|
||||
manager_->GetInterestGroupAdAuctionData(
|
||||
/*seller=*/test_origin, /*top_level_origin=*/test_origin,
|
||||
base::BindLambdaForTesting([&](std::vector<uint8_t> inner_msg) {
|
||||
msg = inner_msg;
|
||||
run_loop.Quit();
|
||||
}));
|
||||
run_loop.Run();
|
||||
EXPECT_EQ("", base::Base64Encode(msg));
|
||||
}
|
||||
|
||||
TEST_F(AdAuctionServiceImplTest, SerializesAuctionBlobWithEmptyGroup) {
|
||||
url::Origin test_origin = url::Origin::Create(GURL(kOriginStringA));
|
||||
manager_->JoinInterestGroup(
|
||||
blink::TestInterestGroupBuilder(test_origin, "cars").Build(),
|
||||
GURL("https://a.test/example.html"));
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
|
||||
std::vector<uint8_t> msg;
|
||||
base::RunLoop run_loop;
|
||||
manager_->GetInterestGroupAdAuctionData(
|
||||
/*seller=*/test_origin, /*top_level_origin=*/test_origin,
|
||||
base::BindLambdaForTesting([&](std::vector<uint8_t> inner_msg) {
|
||||
msg = inner_msg;
|
||||
run_loop.Quit();
|
||||
}));
|
||||
run_loop.Run();
|
||||
EXPECT_EQ("", base::Base64Encode(msg));
|
||||
}
|
||||
|
||||
TEST_F(AdAuctionServiceImplTest, SerializesMultipleOwnersAuctionBlob) {
|
||||
url::Origin test_origin_a = url::Origin::Create(GURL(kOriginStringA));
|
||||
url::Origin test_origin_b = url::Origin::Create(GURL(kOriginStringB));
|
||||
manager_->JoinInterestGroup(
|
||||
blink::TestInterestGroupBuilder(test_origin_a, "cars").Build(),
|
||||
test_origin_a.GetURL().Resolve("/example.html"));
|
||||
// fast-forward so second join has different time.
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
manager_->JoinInterestGroup(
|
||||
blink::TestInterestGroupBuilder(test_origin_a, "cars")
|
||||
.SetAds(
|
||||
{{{GURL("https://c.test/ad.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "1234"},
|
||||
{GURL("https://c.test/ad2.html"), /*metadata=*/absl::nullopt},
|
||||
{GURL("https://c.test/ad3.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "456"}}})
|
||||
.SetAdComponents(
|
||||
{{{GURL("https://c.test/ad4.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "789"}}})
|
||||
.Build(),
|
||||
test_origin_a.GetURL().Resolve("/example.html"));
|
||||
manager_->RecordInterestGroupWin(
|
||||
{test_origin_a, "cars"},
|
||||
R"({"renderUrl": "https://c.test/ad.html", "adRenderId": "1234"})");
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
manager_->RecordInterestGroupWin(
|
||||
{test_origin_a, "cars"}, R"({"renderUrl": "https://c.test/ad2.html"})");
|
||||
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
manager_->JoinInterestGroup(
|
||||
blink::TestInterestGroupBuilder(test_origin_a, "boats")
|
||||
.SetAds(
|
||||
{{{GURL("https://c.test/ad6.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "Boat1"},
|
||||
{GURL("https://c.test/ad7.html"), /*metadata=*/absl::nullopt},
|
||||
{GURL("https://c.test/ad8.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "Boat2"}}})
|
||||
.SetAdComponents(
|
||||
{{{GURL("https://c.test/ad9.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "Boat3"}}})
|
||||
.Build(),
|
||||
test_origin_a.GetURL().Resolve("/example.html"));
|
||||
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
manager_->JoinInterestGroup(
|
||||
blink::TestInterestGroupBuilder(test_origin_b, "trains")
|
||||
.SetAds(
|
||||
{{{GURL("https://b.test/ad6.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "Train1"},
|
||||
{GURL("https://b.test/ad7.html"), /*metadata=*/absl::nullopt},
|
||||
{GURL("https://b.test/ad8.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "Train2"}}})
|
||||
.SetAdComponents(
|
||||
{{{GURL("https://b.test/ad9.html"), /*metadata=*/absl::nullopt,
|
||||
/*size_group=*/absl::nullopt,
|
||||
/*buyer_reporting_id=*/absl::nullopt,
|
||||
/*buyer_and_seller_reporting_id=*/absl::nullopt, "Train3"}}})
|
||||
.Build(),
|
||||
test_origin_b.GetURL().Resolve("/example.html"));
|
||||
task_environment()->FastForwardBy(base::Seconds(1));
|
||||
|
||||
std::vector<uint8_t> msg;
|
||||
base::RunLoop run_loop;
|
||||
manager_->GetInterestGroupAdAuctionData(
|
||||
/*seller=*/test_origin_a, /*top_level_origin=*/test_origin_a,
|
||||
base::BindLambdaForTesting([&](std::vector<uint8_t> inner_msg) {
|
||||
msg = inner_msg;
|
||||
run_loop.Quit();
|
||||
}));
|
||||
run_loop.Run();
|
||||
|
||||
std::string expected =
|
||||
"o2d2ZXJzaW9uAGlwdWJsaXNoZXJuaHR0cHM6Ly9hLnRlc3RuaW50ZXJlc3RHcm91cHOibmh0"
|
||||
"dHBzOi8vYS50ZXN0WJkfiwgAAAAAAAAAdc07DsIwDAZgKL1QH7xWOAIDK45jtUGtU9kBxAY5"
|
||||
"Sw9KFQYkBIv1y7b+L44IViPtPIQizdIy9ERmitqB3ft+"
|
||||
"8Ewc9JnOFRvxNyU5uIah07ERQmK8Z61x0/eFw6wdhK5Hx/"
|
||||
"pwZ+84LedvyBZlVWO9XCXFIsgXguvN9h+R/yBiXJxinmo/"
|
||||
"WPYCdURNadcAAABuaHR0cHM6Ly9iLnRlc3RYch+"
|
||||
"LCAAAAAAAAABrXJKcmFLclBZSlJiZZwihjFLyEnNT00pA7OKcxBTn/NyC/"
|
||||
"LzUvJLiRogC47ykovzy4tSi4Mz0vMSc4iXpRanJqXnJlYwZSZlA5aV5JQwZBUWpZeFAAxoys"
|
||||
"/Iz88CCjADfoTrIbgAAAA==";
|
||||
EXPECT_EQ(expected, base::Base64Encode(msg));
|
||||
}
|
||||
|
||||
} // namespace content
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "base/containers/span.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/json/json_string_value_serializer.h"
|
||||
#include "base/json/values_util.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/observer_list.h"
|
||||
@ -23,8 +21,6 @@
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/threading/sequence_bound.h"
|
||||
#include "base/time/time.h"
|
||||
#include "components/cbor/diagnostic_writer.h"
|
||||
#include "components/cbor/writer.h"
|
||||
#include "content/browser/interest_group/interest_group_storage.h"
|
||||
#include "content/browser/interest_group/interest_group_update.h"
|
||||
#include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom.h"
|
||||
@ -32,7 +28,6 @@
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
#include "services/network/public/mojom/client_security_state.mojom.h"
|
||||
#include "third_party/blink/public/common/interest_group/interest_group.h"
|
||||
#include "third_party/zlib/google/compression_utils.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace content {
|
||||
@ -106,100 +101,11 @@ ConvertOwnerJoinerPairsToDataKeys(
|
||||
return data_keys;
|
||||
}
|
||||
|
||||
cbor::Value SerializeAds(const std::vector<blink::InterestGroup::Ad>& ads) {
|
||||
cbor::Value::ArrayValue result;
|
||||
for (const auto& ad : ads) {
|
||||
if (ad.ad_render_id) {
|
||||
result.emplace_back(ad.ad_render_id.value());
|
||||
}
|
||||
}
|
||||
return cbor::Value(std::move(result));
|
||||
}
|
||||
|
||||
// This serialization is sent to the bidding and auction (B&A) server, so the
|
||||
// format is standardized. We can't add fields to this format without
|
||||
// coordinating with the B&A team.
|
||||
cbor::Value SerializeInterestGroup(base::Time start_time,
|
||||
const StorageInterestGroup& group) {
|
||||
cbor::Value::MapValue group_obj;
|
||||
group_obj[cbor::Value("name")] = cbor::Value(group.interest_group.name);
|
||||
if (group.interest_group.trusted_bidding_signals_keys) {
|
||||
cbor::Value::ArrayValue bidding_signal_keys;
|
||||
bidding_signal_keys.reserve(
|
||||
group.interest_group.trusted_bidding_signals_keys->size());
|
||||
for (const auto& key : *group.interest_group.trusted_bidding_signals_keys) {
|
||||
bidding_signal_keys.emplace_back(key);
|
||||
}
|
||||
group_obj[cbor::Value("biddingSignalsKeys")] =
|
||||
cbor::Value(std::move(bidding_signal_keys));
|
||||
}
|
||||
if (group.interest_group.user_bidding_signals) {
|
||||
group_obj[cbor::Value("userBiddingSignals")] =
|
||||
cbor::Value(*group.interest_group.user_bidding_signals);
|
||||
}
|
||||
if (group.interest_group.ads) {
|
||||
group_obj[cbor::Value("ads")] = SerializeAds(*group.interest_group.ads);
|
||||
}
|
||||
if (group.interest_group.ad_components) {
|
||||
group_obj[cbor::Value("adComponents")] =
|
||||
SerializeAds(*group.interest_group.ad_components);
|
||||
}
|
||||
cbor::Value::MapValue browser_signals;
|
||||
browser_signals[cbor::Value("bidCount")] =
|
||||
cbor::Value(group.bidding_browser_signals->bid_count);
|
||||
// joinCount and recency are noised and binned on the server.
|
||||
browser_signals[cbor::Value("joinCount")] =
|
||||
cbor::Value(group.bidding_browser_signals->join_count);
|
||||
int64_t recency = (start_time - group.join_time).InSeconds();
|
||||
browser_signals[cbor::Value("recency")] =
|
||||
cbor::Value(std::max<int64_t>(0, recency));
|
||||
cbor::Value::ArrayValue prev_wins;
|
||||
for (const auto& prev_win : group.bidding_browser_signals->prev_wins) {
|
||||
cbor::Value::ArrayValue tuple;
|
||||
int64_t win_time = (start_time - prev_win->time).InSeconds();
|
||||
tuple.emplace_back(std::max<int64_t>(0, win_time));
|
||||
// We trust this ad_json because we wrote it ourselves.
|
||||
// Currently it's probably not worth it to deserialize this at the same time
|
||||
// we load the interest group from the database. We will want to revisit
|
||||
// this in the future.
|
||||
JSONStringValueDeserializer deserializer(prev_win->ad_json);
|
||||
std::string error_msg;
|
||||
std::unique_ptr<base::Value> ad = deserializer.Deserialize(
|
||||
/*error_code=*/nullptr,
|
||||
/*error_message=*/&error_msg);
|
||||
if (!ad) {
|
||||
// This should not happen unless the DB is corrupted.
|
||||
// Just do our best regardless.
|
||||
continue;
|
||||
}
|
||||
std::string* ad_render_id = ad->GetDict().FindString("adRenderId");
|
||||
if (ad_render_id) {
|
||||
tuple.emplace_back(*ad_render_id);
|
||||
} else {
|
||||
// If there's no adRenderId we still can send the time.
|
||||
tuple.emplace_back("");
|
||||
}
|
||||
prev_wins.emplace_back(std::move(tuple));
|
||||
}
|
||||
browser_signals[cbor::Value("prevWins")] = cbor::Value(std::move(prev_wins));
|
||||
group_obj[cbor::Value("browserSignals")] =
|
||||
cbor::Value(std::move(browser_signals));
|
||||
return cbor::Value(std::move(group_obj));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
InterestGroupManagerImpl::ReportRequest::ReportRequest() = default;
|
||||
InterestGroupManagerImpl::ReportRequest::~ReportRequest() = default;
|
||||
|
||||
InterestGroupManagerImpl::AdAuctionDataLoaderState::AdAuctionDataLoaderState() {
|
||||
start_time = base::Time::Now();
|
||||
}
|
||||
InterestGroupManagerImpl::AdAuctionDataLoaderState::AdAuctionDataLoaderState(
|
||||
AdAuctionDataLoaderState&& state) = default;
|
||||
InterestGroupManagerImpl::AdAuctionDataLoaderState::
|
||||
~AdAuctionDataLoaderState() = default;
|
||||
|
||||
InterestGroupManagerImpl::InterestGroupManagerImpl(
|
||||
const base::FilePath& path,
|
||||
bool in_memory,
|
||||
@ -492,91 +398,6 @@ void InterestGroupManagerImpl::UpdateLastKAnonymityReported(
|
||||
.WithArgs(key);
|
||||
}
|
||||
|
||||
void InterestGroupManagerImpl::GetInterestGroupAdAuctionData(
|
||||
url::Origin seller,
|
||||
url::Origin top_level_origin,
|
||||
base::OnceCallback<void(std::vector<uint8_t>)> callback) {
|
||||
AdAuctionDataLoaderState state;
|
||||
state.seller = std::move(seller);
|
||||
state.top_level_origin = std::move(top_level_origin);
|
||||
state.callback = std::move(callback);
|
||||
GetAllInterestGroupOwners(base::BindOnce(
|
||||
&InterestGroupManagerImpl::LoadNextInterestGroupAdAuctionData,
|
||||
weak_factory_.GetWeakPtr(), std::move(state)));
|
||||
}
|
||||
|
||||
void InterestGroupManagerImpl::LoadNextInterestGroupAdAuctionData(
|
||||
AdAuctionDataLoaderState state,
|
||||
std::vector<url::Origin> owners) {
|
||||
if (!owners.empty()) {
|
||||
url::Origin next_owner = std::move(owners.back());
|
||||
owners.pop_back();
|
||||
GetInterestGroupsForOwner(
|
||||
next_owner,
|
||||
base::BindOnce(
|
||||
&InterestGroupManagerImpl::OnLoadedNextInterestGroupAdAuctionData,
|
||||
weak_factory_.GetWeakPtr(), std::move(state), std::move(owners),
|
||||
next_owner));
|
||||
return;
|
||||
}
|
||||
// Loading is finished.
|
||||
OnAdAuctionDataLoadComplete(std::move(state));
|
||||
}
|
||||
|
||||
void InterestGroupManagerImpl::OnLoadedNextInterestGroupAdAuctionData(
|
||||
AdAuctionDataLoaderState state,
|
||||
std::vector<url::Origin> owners,
|
||||
url::Origin owner,
|
||||
std::vector<StorageInterestGroup> groups) {
|
||||
base::EraseIf(groups, [](const StorageInterestGroup& group) {
|
||||
return (!group.interest_group.ads) || (group.interest_group.ads->empty());
|
||||
});
|
||||
if (!groups.empty()) {
|
||||
state.accumulated_groups.emplace_back(owner.Serialize(), std::move(groups));
|
||||
}
|
||||
LoadNextInterestGroupAdAuctionData(std::move(state), std::move(owners));
|
||||
}
|
||||
|
||||
void InterestGroupManagerImpl::OnAdAuctionDataLoadComplete(
|
||||
AdAuctionDataLoaderState state) {
|
||||
if (state.accumulated_groups.empty()) {
|
||||
std::move(state.callback).Run({});
|
||||
return;
|
||||
}
|
||||
cbor::Value::MapValue groups_map;
|
||||
groups_map.reserve(state.accumulated_groups.size());
|
||||
for (const auto& bidder_groups : state.accumulated_groups) {
|
||||
cbor::Value::ArrayValue groups;
|
||||
for (const auto& group : bidder_groups.second) {
|
||||
cbor::Value group_obj = SerializeInterestGroup(state.start_time, group);
|
||||
groups.emplace_back(std::move(group_obj));
|
||||
}
|
||||
cbor::Value groups_obj(std::move(groups));
|
||||
absl::optional<std::vector<uint8_t>> maybe_sub_message =
|
||||
cbor::Writer::Write(groups_obj);
|
||||
DCHECK(maybe_sub_message);
|
||||
std::string compressed_groups;
|
||||
DCHECK(compression::GzipCompress(maybe_sub_message.value(),
|
||||
&compressed_groups));
|
||||
groups_map[cbor::Value(bidder_groups.first)] =
|
||||
cbor::Value(compressed_groups, cbor::Value::Type::BYTE_STRING);
|
||||
}
|
||||
cbor::Value::MapValue message_obj;
|
||||
message_obj[cbor::Value("version")] = cbor::Value(0);
|
||||
// "gzip" is the default so we don't need to specify the compression.
|
||||
// message_obj[cbor::Value("compression")] = cbor::Value("gzip");
|
||||
message_obj[cbor::Value("publisher")] =
|
||||
cbor::Value(state.top_level_origin.Serialize());
|
||||
|
||||
message_obj[cbor::Value("interestGroups")] =
|
||||
cbor::Value(std::move(groups_map));
|
||||
cbor::Value message(std::move(message_obj));
|
||||
|
||||
absl::optional<std::vector<uint8_t>> maybe_msg = cbor::Writer::Write(message);
|
||||
DCHECK(maybe_msg);
|
||||
std::move(state.callback).Run(std::move(maybe_msg).value());
|
||||
}
|
||||
|
||||
void InterestGroupManagerImpl::OnJoinInterestGroupPermissionsChecked(
|
||||
blink::InterestGroup group,
|
||||
const GURL& joining_url,
|
||||
|
@ -314,11 +314,6 @@ class CONTENT_EXPORT InterestGroupManagerImpl : public InterestGroupManager {
|
||||
// Updates the last time that the key was reported to the k-anonymity server.
|
||||
void UpdateLastKAnonymityReported(const std::string& key);
|
||||
|
||||
void GetInterestGroupAdAuctionData(
|
||||
url::Origin seller,
|
||||
url::Origin top_level_origin,
|
||||
base::OnceCallback<void(std::vector<uint8_t>)> callback);
|
||||
|
||||
InterestGroupPermissionsChecker& permissions_checker_for_testing() {
|
||||
return permissions_checker_;
|
||||
}
|
||||
@ -347,20 +342,6 @@ class CONTENT_EXPORT InterestGroupManagerImpl : public InterestGroupManager {
|
||||
int request_url_size_bytes;
|
||||
};
|
||||
|
||||
struct AdAuctionDataLoaderState {
|
||||
AdAuctionDataLoaderState();
|
||||
~AdAuctionDataLoaderState();
|
||||
AdAuctionDataLoaderState(AdAuctionDataLoaderState&& state);
|
||||
base::Time start_time;
|
||||
url::Origin seller;
|
||||
url::Origin top_level_origin;
|
||||
// List of Interest group owners (string) and their interest groups
|
||||
// (vector).
|
||||
std::vector<std::pair<std::string, std::vector<StorageInterestGroup>>>
|
||||
accumulated_groups;
|
||||
base::OnceCallback<void(std::vector<uint8_t>)> callback;
|
||||
};
|
||||
|
||||
// Callbacks for CheckPermissionsAndJoinInterestGroup() and
|
||||
// CheckPermissionsAndLeaveInterestGroup(), respectively. Call
|
||||
// JoinInterestGroup() and LeaveInterestGroup() if the results of the
|
||||
@ -437,23 +418,6 @@ class CONTENT_EXPORT InterestGroupManagerImpl : public InterestGroupManager {
|
||||
void QueueKAnonymityUpdateForInterestGroupFromJoinInterestGroup(
|
||||
absl::optional<StorageInterestGroup> maybe_group);
|
||||
|
||||
// Loads the next owner's interest group data. If there are no more owners
|
||||
// whose interest groups need to be loaded, calls OnAdAuctionDataLoadComplete.
|
||||
void LoadNextInterestGroupAdAuctionData(AdAuctionDataLoaderState state,
|
||||
std::vector<url::Origin> owners);
|
||||
|
||||
// Serializes the loaded auction data and then calls
|
||||
// LoadNextInterestGroupAdAuctionData to continue loading.
|
||||
void OnLoadedNextInterestGroupAdAuctionData(
|
||||
AdAuctionDataLoaderState state,
|
||||
std::vector<url::Origin> owners,
|
||||
url::Origin owner,
|
||||
std::vector<StorageInterestGroup> groups);
|
||||
|
||||
// Constructs the AuctionAdata when the load is complete and calls the
|
||||
// provided callback.
|
||||
void OnAdAuctionDataLoadComplete(AdAuctionDataLoaderState state);
|
||||
|
||||
// Owns and manages access to the InterestGroupStorage living on a different
|
||||
// thread.
|
||||
base::SequenceBound<InterestGroupStorage> impl_;
|
||||
|
@ -166,10 +166,6 @@ these:
|
||||
|
||||
See crrev.com/c/3517534 for an example (adding the priority field), and also
|
||||
remember to update bidder_worklet.cc too.
|
||||
|
||||
If the new field should be sent to the B&A server for server-side auctions then
|
||||
SerializeInterestGroup() in interest_group_manager_impl.cc needs modified to
|
||||
support the new field.
|
||||
)");
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user