Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ContextFactory.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
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 skiatest_graphite_ContextFactory_DEFINED
9#define skiatest_graphite_ContextFactory_DEFINED
10
18
19namespace skgpu::graphite {
20class Context;
21}
22
23namespace skiatest::graphite {
24
29
31public:
32 explicit ContextFactory(const TestOptions&);
33 ContextFactory() = default;
36
37 ~ContextFactory() = default;
38
40
41private:
42 struct OwnedContextInfo {
43 OwnedContextInfo();
44 OwnedContextInfo(skgpu::ContextType,
45 std::unique_ptr<GraphiteTestContext>,
46 std::unique_ptr<skgpu::graphite::Context>);
47
48 ~OwnedContextInfo();
49 OwnedContextInfo(OwnedContextInfo&&);
50 OwnedContextInfo& operator=(OwnedContextInfo&&);
51
52 // This holds the same data as ContextInfo, but uses unique_ptr to maintain ownership.
53 skgpu::ContextType fType = skgpu::ContextType::kMock;
54 std::unique_ptr<GraphiteTestContext> fTestContext;
55 std::unique_ptr<skgpu::graphite::Context> fContext;
56 };
57
58 static ContextInfo AsContextInfo(const OwnedContextInfo& ctx);
59
61 const TestOptions fOptions = {};
62};
63
64} // namespace skiatest::graphite
65
66#endif // skiatest_graphite_ContextFactory_DEFINED
const Context & fContext
ContextInfo getContextInfo(skgpu::ContextType)
ContextFactory & operator=(const ContextFactory &)=delete
ContextFactory(const ContextFactory &)=delete
GraphiteTestContext * fTestContext
skgpu::graphite::Context * fContext