Flutter Engine
The Flutter Engine
GrMockRenderTask.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrMockRenderTask_DEFINED
9#define GrMockRenderTask_DEFINED
10
18
19#include <utility>
20
21class GrOpFlushState;
24struct SkIRect;
25
26class GrMockRenderTask final : public GrRenderTask {
27public:
29 // Mock tasks are never "owned" by a drawmgr in the first place.
31 }
32
33 void addTarget(sk_sp<GrSurfaceProxy> proxy) { fTargets.push_back(std::move(proxy)); }
34 void addDependency(GrRenderTask* dep) { fDependencies.push_back(dep); }
35 void addUsed(sk_sp<GrSurfaceProxy> proxy) { fUsed.push_back(std::move(proxy)); }
36
37 // Overrides.
38#ifdef SK_DEBUG
39 void visitProxies_debugOnly(const GrVisitProxyFunc&) const override { return; }
40#endif
43 bool onIsUsed(GrSurfaceProxy* proxy) const override {
44 for (const auto& entry : fUsed) {
45 if (entry.get() == proxy) {
46 return true;
47 }
48 }
49 return false;
50 }
51 bool onExecute(GrOpFlushState*) override { return true; }
52
53#if defined(GR_TEST_UTILS)
54 const char* name() const final { return "Mock"; }
55#endif
56
57private:
59};
60
61#endif
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
Definition: GrTypesPriv.h:943
#define SkUNREACHABLE
Definition: SkAssert.h:135
bool onExecute(GrOpFlushState *) override
void gatherProxyIntervals(GrResourceAllocator *) const override
bool onIsUsed(GrSurfaceProxy *proxy) const override
void addUsed(sk_sp< GrSurfaceProxy > proxy)
void addDependency(GrRenderTask *dep)
void addTarget(sk_sp< GrSurfaceProxy > proxy)
ExpectedOutcome onMakeClosed(GrRecordingContext *, SkIRect *) override
void setFlag(uint32_t flag)
Definition: GrRenderTask.h:200
skia_private::STArray< 1, sk_sp< GrSurfaceProxy > > fTargets
Definition: GrRenderTask.h:182
@ kDisowned_Flag
This task is disowned by its GrDrawingManager.
Definition: GrRenderTask.h:191
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
Definition: SkRect.h:32