Flutter Engine
The Flutter Engine
third_party
skia
tools
gpu
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
8
#include "
tools/gpu/FlushFinishTracker.h
"
9
10
#include "
include/gpu/GrDirectContext.h
"
11
#include "
src/core/SkTraceEvent.h
"
12
13
#if defined(SK_GRAPHITE)
14
#include "
include/gpu/graphite/Context.h
"
15
#endif
16
17
#include <chrono>
18
19
namespace
sk_gpu_test
{
20
21
void
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
Context.h
FlushFinishTracker.h
GrDirectContext.h
SkDEBUGFAIL
#define SkDEBUGFAIL(message)
Definition:
SkAssert.h:118
SkASSERT
#define SkASSERT(cond)
Definition:
SkAssert.h:116
SkDebugf
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SkTraceEvent.h
TRACE_FUNC
#define TRACE_FUNC
Definition:
SkTraceEvent.h:30
GrDirectContext::checkAsyncWorkCompletion
void checkAsyncWorkCompletion()
Definition:
GrDirectContext.cpp:531
sk_gpu_test::FlushFinishTracker::waitTillFinished
void waitTillFinished(std::function< void()> tick={})
Definition:
FlushFinishTracker.cpp:21
begin
static const char * begin(const StringSlice &s)
Definition:
editor.cpp:252
end
glong glong end
Definition:
fl_accessible_text_field.cc:40
function
Dart_NativeFunction function
Definition:
fuchsia.cc:51
sk_gpu_test
Definition:
gm_bindings.cpp:339
TRACE_EVENT0
#define TRACE_EVENT0(category_group, name)
Definition:
trace_event.h:131
Generated on Sun Jun 23 2024 21:56:50 for Flutter Engine by
1.9.4