[go: nahoru, domu]

blob: 4b56a60a8ded12bd1c32e74b1695dd523a7d376c [file] [log] [blame]
Xida Chene3019ab2019-01-02 21:13:481// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CC_PAINT_PAINT_WORKLET_LAYER_PAINTER_H_
6#define CC_PAINT_PAINT_WORKLET_LAYER_PAINTER_H_
7
Stephen McGruer8bee6b12019-06-06 15:15:338#include "base/callback.h"
9#include "cc/paint/paint_export.h"
Xida Chenea3139f2019-01-10 21:46:3010#include "cc/paint/paint_record.h"
Stephen McGruer8bee6b12019-06-06 15:15:3311#include "cc/paint/paint_worklet_job.h"
Xida Chene3019ab2019-01-02 21:13:4812
13namespace cc {
14
Stephen McGruer8bee6b12019-06-06 15:15:3315// PaintWorkletLayerPainter bridges between the compositor and the PaintWorklet
16// thread, providing hooks for the compositor to paint PaintWorklet content that
17// Blink has deferred on.
18class CC_PAINT_EXPORT PaintWorkletLayerPainter {
Xida Chene3019ab2019-01-02 21:13:4819 public:
20 virtual ~PaintWorkletLayerPainter() {}
21
Stephen McGruer8bee6b12019-06-06 15:15:3322 // Asynchronously paints a set of PaintWorklet instances. The results are
23 // returned via the provided callback, on the same thread that originally
24 // called this method.
Stephen McGruer8e2d3552019-07-10 14:06:2925 //
26 // Only one dispatch is allowed at a time; the calling code should not call
27 // |DispatchWorklets| again until the passed |DoneCallback| has been called.
Stephen McGruer8bee6b12019-06-06 15:15:3328 using DoneCallback = base::OnceCallback<void(PaintWorkletJobMap)>;
29 virtual void DispatchWorklets(PaintWorkletJobMap, DoneCallback) = 0;
Stephen McGruer8e2d3552019-07-10 14:06:2930
31 // Returns whether or not a dispatched set of PaintWorklet instances is
32 // currently being painted.
33 virtual bool HasOngoingDispatch() const = 0;
Xida Chene3019ab2019-01-02 21:13:4834};
35
36} // namespace cc
37
38#endif // CC_PAINT_PAINT_WORKLET_LAYER_PAINTER_H_