blob: f33424d85471a4714affd08f03df984009d93095 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/raster/paint_worklet_image_provider.h"
#include <utility>
#include "cc/tiles/paint_worklet_image_cache.h"
namespace cc {
PaintWorkletImageProvider::PaintWorkletImageProvider(
PaintWorkletImageCache* cache)
: cache_(cache) {
DCHECK(cache_);
}
PaintWorkletImageProvider::~PaintWorkletImageProvider() = default;
PaintWorkletImageProvider::PaintWorkletImageProvider(
PaintWorkletImageProvider&& other) = default;
PaintWorkletImageProvider& PaintWorkletImageProvider::operator=(
PaintWorkletImageProvider&& other) = default;
ImageProvider::ScopedResult PaintWorkletImageProvider::GetPaintRecordResult(
PaintWorkletInput* input) {
std::pair<PaintRecord*, base::OnceCallback<void()>> record_and_callback =
cache_->GetPaintRecordAndRef(input);
return ImageProvider::ScopedResult(record_and_callback.first,
std::move(record_and_callback.second));
}
} // namespace cc