#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h"
#include <stddef.h>
#include <memory>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial_params.h"
#include "base/not_fatal_until.h"
#include "build/build_config.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
#include "chrome/browser/image_decoder/image_decoder.h"
#include "chrome/browser/profiles/profile.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/common/omnibox_features.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "net/base/load_flags.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace {
const size_t kMaxRequests = …;
#if BUILDFLAG(IS_ANDROID)
const int kMaxCacheEntries = 0;
#else
const int kMaxCacheEntries = …;
#endif
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
}
class BitmapFetcherRequest { … };
BitmapFetcherRequest::BitmapFetcherRequest(
BitmapFetcherService::RequestId request_id,
BitmapFetcherService::BitmapFetchedCallback callback)
: … { … }
BitmapFetcherRequest::~BitmapFetcherRequest() = default;
void BitmapFetcherRequest::NotifyImageChanged(const SkBitmap* bitmap) { … }
BitmapFetcherService::CacheEntry::CacheEntry() = default;
BitmapFetcherService::CacheEntry::~CacheEntry() = default;
BitmapFetcherService::BitmapFetcherService(content::BrowserContext* context)
: … { … }
BitmapFetcherService::~BitmapFetcherService() { … }
void BitmapFetcherService::CancelRequest(int request_id) { … }
BitmapFetcherService::RequestId BitmapFetcherService::RequestImageForTesting(
const GURL& url,
BitmapFetchedCallback callback,
const net::NetworkTrafficAnnotationTag& traffic_annotation) { … }
BitmapFetcherService::RequestId BitmapFetcherService::RequestImageImpl(
const GURL& url,
BitmapFetchedCallback callback,
const net::NetworkTrafficAnnotationTag& traffic_annotation) { … }
void BitmapFetcherService::Prefetch(const GURL& url) { … }
bool BitmapFetcherService::IsCached(const GURL& url) { … }
std::unique_ptr<BitmapFetcher> BitmapFetcherService::CreateFetcher(
const GURL& url,
const net::NetworkTrafficAnnotationTag& traffic_annotation) { … }
BitmapFetcherService::RequestId BitmapFetcherService::RequestImage(
const GURL& url,
BitmapFetchedCallback callback) { … }
const BitmapFetcher* BitmapFetcherService::EnsureFetcherForUrl(
const GURL& url,
const net::NetworkTrafficAnnotationTag& traffic_annotation) { … }
const BitmapFetcher* BitmapFetcherService::FindFetcherForUrl(const GURL& url) { … }
void BitmapFetcherService::RemoveFetcher(const BitmapFetcher* fetcher) { … }
void BitmapFetcherService::OnFetchComplete(const GURL& url,
const SkBitmap* bitmap) { … }