chromium/third_party/blink/renderer/platform/loader/fetch/resource_load_observer.h

// 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.

#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_RESOURCE_LOAD_OBSERVER_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_RESOURCE_LOAD_OBSERVER_H_

#include <inttypes.h>

#include "base/containers/span_or_size.h"
#include "base/types/strong_alias.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_load_priority.h"
#include "third_party/blink/renderer/platform/platform_export.h"

namespace blink {

class KURL;
class FetchParameters;
class ResourceError;
class ResourceRequest;
class ResourceResponse;
enum class ResourceType : uint8_t;

// ResourceLoadObserver is a collection of functions which meet following
// conditions.
// 1. It's not possible to implement it in platform/loader.
// 2. It's about individual loading operation. For example, a function
//    notifying that all requests are gone would not belong to this class.
// 3. It is called when the loader gets some input, typically from the network
//    subsystem. There may be some cases where the source of the input is not
//    from network - For example, this class may have a function which is called
//    when ResourceFetcher::RequestResource is called. On the other hand, this
//    class will not have "operation"s, such as PrepareRequest.
//
// All functions except for the destructor and the trace method must be pure
// virtual, and must not be called when the associated fetcher is detached.
class PLATFORM_EXPORT ResourceLoadObserver
    : public GarbageCollected<ResourceLoadObserver> {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_RESOURCE_LOAD_OBSERVER_H_