chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/cached_metadata_handler.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/loader/fetch/url_loader/cached_metadata_handler.h"

#include "base/time/time.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/mojom/loader/code_cache.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/renderer/platform/loader/fetch/code_cache_host.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"

namespace blink {

// This is a CachedMetadataSender implementation for normal responses.
class CachedMetadataSenderImpl : public CachedMetadataSender {};

CachedMetadataSenderImpl::CachedMetadataSenderImpl(
    const ResourceResponse& response,
    mojom::blink::CodeCacheType code_cache_type)
    :{}

void CachedMetadataSenderImpl::Send(CodeCacheHost* code_cache_host,
                                    base::span<const uint8_t> data) {}

// This is a CachedMetadataSender implementation that does nothing.
class NullCachedMetadataSender : public CachedMetadataSender {};

// This is a CachedMetadataSender implementation for responses that are served
// by a ServiceWorker from cache storage.
class ServiceWorkerCachedMetadataSender : public CachedMetadataSender {};

ServiceWorkerCachedMetadataSender::ServiceWorkerCachedMetadataSender(
    const ResourceResponse& response,
    scoped_refptr<const SecurityOrigin> security_origin)
    :{}

void ServiceWorkerCachedMetadataSender::Send(CodeCacheHost* code_cache_host,
                                             base::span<const uint8_t> data) {}

// static
void CachedMetadataSender::SendToCodeCacheHost(
    CodeCacheHost* code_cache_host,
    mojom::blink::CodeCacheType code_cache_type,
    WTF::String url,
    base::Time response_time,
    const String& cache_storage_name,
    const uint8_t* data,
    size_t size) {}

// static
std::unique_ptr<CachedMetadataSender> CachedMetadataSender::Create(
    const ResourceResponse& response,
    mojom::blink::CodeCacheType code_cache_type,
    scoped_refptr<const SecurityOrigin> requestor_origin) {}

bool ShouldUseIsolatedCodeCache(
    mojom::blink::RequestContextType request_context,
    const ResourceResponse& response) {}

}  // namespace blink