Flutter Engine
The Flutter Engine
TestContext.cpp
Go to the documentation of this file.
1
2/*
3 * Copyright 2016 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
10
14#include "tools/gpu/GpuTimer.h"
15
16namespace sk_gpu_test {
17TestContext::TestContext() : fGpuTimer(nullptr) {}
18
20 // Subclass should call teardown.
22}
23
25 return nullptr;
26}
27
30
33 this->makeCurrent();
34 return asr;
35}
36
38 TRACE_EVENT0("skia.gpu", TRACE_FUNC);
39 SkASSERT(context);
40
41 if (fFinishTrackers[fCurrentFlushIdx]) {
42 fFinishTrackers[fCurrentFlushIdx]->waitTillFinished();
43 }
44
45 fFinishTrackers[fCurrentFlushIdx].reset(new FlushFinishTracker(context));
46
47 // We add an additional ref to the current flush tracker here. This ref is owned by the finish
48 // callback on the flush call. The finish callback will unref the tracker when called.
49 fFinishTrackers[fCurrentFlushIdx]->ref();
50
51 GrFlushInfo flushInfo;
53 flushInfo.fFinishedContext = fFinishTrackers[fCurrentFlushIdx].get();
54
55 context->flush(flushInfo);
56 context->submit();
57
58 fCurrentFlushIdx = (fCurrentFlushIdx + 1) % std::size(fFinishTrackers);
59}
60
62 SkASSERT(context);
63 context->flush();
64 context->submit(GrSyncCpu::kYes);
65}
66
68}
69
71 fGpuTimer.reset();
72}
73
74} // namespace sk_gpu_test
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define TRACE_FUNC
Definition: SkTraceEvent.h:30
bool submit(GrSyncCpu sync=GrSyncCpu::kNo)
GrSemaphoresSubmitted flush(const GrFlushInfo &info)
static void FlushFinished(void *finishedContext)
virtual sk_sp< GrDirectContext > makeContext(const GrContextOptions &)
Definition: TestContext.cpp:24
std::unique_ptr< GpuTimer > fGpuTimer
Definition: TestContext.h:89
void flushAndWaitOnSync(GrDirectContext *context)
Definition: TestContext.cpp:37
virtual void teardown()
Definition: TestContext.cpp:70
virtual std::function< void()> onPlatformGetAutoContextRestore() const =0
virtual void onPlatformMakeNotCurrent() const =0
void flushAndSyncCpu(GrDirectContext *)
Definition: TestContext.cpp:61
void makeNotCurrent() const
Definition: TestContext.cpp:28
virtual void testAbandon()
Definition: TestContext.cpp:67
virtual void onPlatformMakeCurrent() const =0
SkScopeExit makeCurrentAndAutoRestore() const
Definition: TestContext.cpp:31
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
GrGpuFinishedContext fFinishedContext
Definition: GrTypes.h:220
GrGpuFinishedProc fFinishedProc
Definition: GrTypes.h:219
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131