blob: 239e25f23c6b3c9fa739cb83a636c34fe25ee1d1 [file] [log] [blame]
// Copyright 2017 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.
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CANVAS_RESOURCE_HOST_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CANVAS_RESOURCE_HOST_H_
#include <memory>
#include "third_party/blink/renderer/platform/graphics/graphics_types.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h"
#include "third_party/blink/renderer/platform/platform_export.h"
namespace cc {
class PaintCanvas;
}
namespace blink {
class CanvasResourceProvider;
class PLATFORM_EXPORT CanvasResourceHost {
public:
virtual ~CanvasResourceHost() = default;
virtual void NotifyGpuContextLost() = 0;
virtual void SetNeedsCompositingUpdate() = 0;
virtual void RestoreCanvasMatrixClipStack(cc::PaintCanvas*) const = 0;
virtual void UpdateMemoryUsage() = 0;
virtual CanvasResourceProvider* GetOrCreateCanvasResourceProvider(
AccelerationHint hint) = 0;
virtual CanvasResourceProvider* GetOrCreateCanvasResourceProviderImpl(
AccelerationHint hint) = 0;
virtual SkFilterQuality FilterQuality() const = 0;
virtual bool LowLatencyEnabled() const { return false; }
CanvasResourceProvider* ResourceProvider() const;
std::unique_ptr<CanvasResourceProvider> ReplaceResourceProvider(
std::unique_ptr<CanvasResourceProvider>);
virtual void DiscardResourceProvider();
private:
std::unique_ptr<CanvasResourceProvider> resource_provider_;
};
} // namespace blink
#endif