#include "content/services/auction_worklet/direct_from_seller_signals_requester.h"
#include <list>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "content/services/auction_worklet/auction_v8_helper.h"
#include "content/services/auction_worklet/public/cpp/auction_downloader.h"
#include "net/http/http_response_headers.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/gurl.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-local-handle.h"
#include "v8/include/v8-primitive.h"
#include "v8/include/v8-value.h"
namespace auction_worklet {
namespace {
std::optional<std::string> CheckHeader(
scoped_refptr<net::HttpResponseHeaders> headers) { … }
enum class DirectFromSellerSignalsRequestType { … };
}
DirectFromSellerSignalsRequester::Result::Result() = default;
DirectFromSellerSignalsRequester::Result::Result(Result&&) = default;
DirectFromSellerSignalsRequester::Result&
DirectFromSellerSignalsRequester::Result::operator=(Result&&) = default;
DirectFromSellerSignalsRequester::Result::~Result() = default;
v8::Local<v8::Value> DirectFromSellerSignalsRequester::Result::GetSignals(
AuctionV8Helper& v8_helper,
v8::Local<v8::Context> context,
std::vector<std::string>& errors) const { … }
bool DirectFromSellerSignalsRequester::Result::IsNull() const { … }
DirectFromSellerSignalsRequester::Result::ResponseString::ResponseString(
std::string&& other)
: … { … }
DirectFromSellerSignalsRequester::Result::ResponseString::~ResponseString() =
default;
DirectFromSellerSignalsRequester::Result::Result(
GURL signals_url,
std::unique_ptr<std::string> response_body,
scoped_refptr<net::HttpResponseHeaders> headers,
std::optional<std::string> error)
: … { … }
DirectFromSellerSignalsRequester::Result::Result(const Result&) = default;
DirectFromSellerSignalsRequester::Result&
DirectFromSellerSignalsRequester::Result::operator=(const Result&) = default;
DirectFromSellerSignalsRequester::Request::~Request() { … }
DirectFromSellerSignalsRequester::Request::Request(
DirectFromSellerSignalsRequesterCallback callback,
DirectFromSellerSignalsRequester& requester,
const GURL& signals_url)
: … { … }
void DirectFromSellerSignalsRequester::Request::RunCallbackSync(Result result) { … }
void DirectFromSellerSignalsRequester::Request::RunCallbackAsync(
Result result) { … }
DirectFromSellerSignalsRequester::DirectFromSellerSignalsRequester() = default;
DirectFromSellerSignalsRequester::~DirectFromSellerSignalsRequester() { … }
std::unique_ptr<DirectFromSellerSignalsRequester::Request>
DirectFromSellerSignalsRequester::LoadSignals(
network::mojom::URLLoaderFactory& url_loader_factory,
const GURL& signals_url,
DirectFromSellerSignalsRequesterCallback callback) { … }
DirectFromSellerSignalsRequester::CoalescedDownload::CoalescedDownload(
std::unique_ptr<AuctionDownloader> downloader)
: … { … }
DirectFromSellerSignalsRequester::CoalescedDownload::~CoalescedDownload() { … }
DirectFromSellerSignalsRequester::CoalescedDownload::CoalescedDownload(
CoalescedDownload&&) = default;
DirectFromSellerSignalsRequester::CoalescedDownload&
DirectFromSellerSignalsRequester::CoalescedDownload::operator=(
CoalescedDownload&&) = default;
void DirectFromSellerSignalsRequester::OnSignalsDownloaded(
GURL signals_url,
base::TimeTicks start_time,
std::unique_ptr<std::string> response_body,
scoped_refptr<net::HttpResponseHeaders> headers,
std::optional<std::string> error) { … }
void DirectFromSellerSignalsRequester::OnRequestDestroyed(Request& request) { … }
}