chromium/content/browser/background_fetch/storage/create_metadata_task.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/background_fetch/storage/create_metadata_task.h"

#include <numeric>
#include <set>
#include <utility>

#include "base/barrier_closure.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/observer_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/background_fetch/background_fetch_data_manager.h"
#include "content/browser/background_fetch/background_fetch_data_manager_observer.h"
#include "content/browser/background_fetch/storage/database_helpers.h"
#include "content/browser/background_fetch/storage/image_helpers.h"
#include "content/browser/background_fetch/storage/mark_registration_for_deletion_task.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/common/background_fetch/background_fetch_types.h"
#include "content/common/fetch/fetch_api_request_proto.h"
#include "third_party/blink/public/common/cache_storage/cache_storage_utils.h"
#include "third_party/blink/public/common/service_worker/service_worker_status_code.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"

namespace content {
namespace background_fetch {

namespace {

// TODO(crbug.com/40595478): Consider making this configurable by finch.
constexpr size_t kRegistrationLimitPerStorageKey =;

// Finds the number of active registrations associated with the provided storage
// key, and compares it with the limit to determine whether this registration
// can go through.
class CanCreateRegistrationTask : public DatabaseTask {};

proto::ImageResource_Purpose
ManifestImageResourcePurposeToImageResoucePurposeProto(
    blink::mojom::ManifestImageResource_Purpose purpose) {}
}  // namespace

CreateMetadataTask::CreateMetadataTask(
    DatabaseTaskHost* host,
    const BackgroundFetchRegistrationId& registration_id,
    std::vector<blink::mojom::FetchAPIRequestPtr> requests,
    blink::mojom::BackgroundFetchOptionsPtr options,
    const SkBitmap& icon,
    bool start_paused,
    const net::IsolationInfo& isolation_info,
    CreateMetadataCallback callback)
    :{}

CreateMetadataTask::~CreateMetadataTask() = default;

void CreateMetadataTask::Start() {}

void CreateMetadataTask::DidGetCanCreateRegistration(
    blink::mojom::BackgroundFetchError error,
    bool can_create) {}

void CreateMetadataTask::DidGetIsQuotaAvailable(bool is_available) {}

void CreateMetadataTask::GetRegistrationUniqueId() {}

void CreateMetadataTask::DidGetUniqueId(const std::vector<std::string>& data,
                                        blink::ServiceWorkerStatusCode status) {}

void CreateMetadataTask::InitializeMetadataProto() {}

void CreateMetadataTask::DidSerializeIcon(std::string serialized_icon) {}

void CreateMetadataTask::StoreMetadata() {}

void CreateMetadataTask::DidStoreMetadata(
    blink::ServiceWorkerStatusCode status) {}

void CreateMetadataTask::DidOpenCache(int64_t trace_id,
                                      blink::mojom::CacheStorageError error) {}

void CreateMetadataTask::DidStoreRequests(
    blink::mojom::CacheStorageVerboseErrorPtr error) {}

void CreateMetadataTask::FinishWithError(
    blink::mojom::BackgroundFetchError error) {}

}  // namespace background_fetch
}  // namespace content