Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
FlushFinishTracker.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 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
9
12
13#if defined(SK_GRAPHITE)
15#endif
16
17#include <chrono>
18
19namespace sk_gpu_test {
20
21void FlushFinishTracker::waitTillFinished(std::function<void()> tick) {
22 TRACE_EVENT0("skia.gpu", TRACE_FUNC);
23 auto begin = std::chrono::steady_clock::now();
24 auto end = begin;
25 while (!fIsFinished && (end - begin) < std::chrono::seconds(2)) {
26 if (tick) {
27 tick();
28 }
29 if (fContext) {
30 fContext->checkAsyncWorkCompletion();
31 } else {
32#if defined(SK_GRAPHITE)
33 SkASSERT(fGraphiteContext);
34 fGraphiteContext->checkAsyncWorkCompletion();
35#else
36 SkDEBUGFAIL("No valid context");
37#endif
38 }
39 end = std::chrono::steady_clock::now();
40 }
41 if (!fIsFinished) {
42 SkDebugf("WARNING: Wait failed for flush sync. Timings might not be accurate.\n");
43 }
44}
45
46} //namespace sk_gpu_test
#define SkDEBUGFAIL(message)
Definition SkAssert.h:118
#define SkASSERT(cond)
Definition SkAssert.h:116
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define TRACE_FUNC
void waitTillFinished(std::function< void()> tick={})
static const char * begin(const StringSlice &s)
Definition editor.cpp:252
glong glong end
#define TRACE_EVENT0(category_group, name)